473,795 Members | 2,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File system error

Hi

I am getting the 'User defined type not defined' on the line;

Dim fso As Scripting.FileS ystemObject.

What am I doing wrong? What reference do I need to add? Do I need to
install/enable scripting on the win xp sp2 machine?

Thanks

Regards

Jan 15 '06 #1
4 6064
John wrote in message <OL************ **@TK2MSFTNGP11 .phx.gbl> :
Hi

I am getting the 'User defined type not defined' on the line;

Dim fso As Scripting.FileS ystemObject.

What am I doing wrong? What reference do I need to add? Do I need to
install/enable scripting on the win xp sp2 machine?

Thanks

Regards


The reference, I think, is Microsoft Scripting Runtime (in VBE - Tools
|
References), or try late binding.

--
Roy-Vidar
Jan 15 '06 #2
"RoyVidar" <ro************ *@yahoo.no> wrote in message
news:mn******** *************** @yahoo.no...
John wrote in message <OL************ **@TK2MSFTNGP11 .phx.gbl> :
Hi

I am getting the 'User defined type not defined' on the line;

Dim fso As Scripting.FileS ystemObject.

What am I doing wrong? What reference do I need to add? Do I need to
install/enable scripting on the win xp sp2 machine?

Thanks

Regards


The reference, I think, is Microsoft Scripting Runtime (in VBE - Tools |
References), or try late binding.


To use Late Binding (which would be my vote if you have to use FSO), you'd
use

Dim fso As Object

Set fso = CreateObject("S cripting.FileSy stemObject")

Note that when you use Late Binding, any intrinsic constants defined by the
Scripting library are unavailable to you: you either need to define the
constants yourself, or replace them by the actual value of the constant. For
example, you couldn't use:

Dim fso As Object
Dim f As Object
Dim ts As Object

Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFile("te st1.txt")
Set ts = f.OpenAsTextStr eam(ForWriting, TristateUseDefa ult)

You'd either have to include a line:

Const ForWriting = 2, TristateUseDefa ult = -2

or rewrite the code as

Dim fso As Object
Dim f As Object
Dim ts As Object

Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFile("te st1.txt")
Set ts = f.OpenAsTextStr eam(2, -2)

Are you sure, though, that you need FSO? There's extremely little that FSO
can do that you can't already do in VBA.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

Jan 15 '06 #3
I am just trying to read an html file from disk.

Thanks

Regards

"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
"RoyVidar" <ro************ *@yahoo.no> wrote in message
news:mn******** *************** @yahoo.no...
John wrote in message <OL************ **@TK2MSFTNGP11 .phx.gbl> :
Hi

I am getting the 'User defined type not defined' on the line;

Dim fso As Scripting.FileS ystemObject.

What am I doing wrong? What reference do I need to add? Do I need to
install/enable scripting on the win xp sp2 machine?

Thanks

Regards


The reference, I think, is Microsoft Scripting Runtime (in VBE - Tools |
References), or try late binding.


To use Late Binding (which would be my vote if you have to use FSO), you'd
use

Dim fso As Object

Set fso = CreateObject("S cripting.FileSy stemObject")

Note that when you use Late Binding, any intrinsic constants defined by
the Scripting library are unavailable to you: you either need to define
the constants yourself, or replace them by the actual value of the
constant. For example, you couldn't use:

Dim fso As Object
Dim f As Object
Dim ts As Object

Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFile("te st1.txt")
Set ts = f.OpenAsTextStr eam(ForWriting, TristateUseDefa ult)

You'd either have to include a line:

Const ForWriting = 2, TristateUseDefa ult = -2

or rewrite the code as

Dim fso As Object
Dim f As Object
Dim ts As Object

Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFile("te st1.txt")
Set ts = f.OpenAsTextStr eam(2, -2)

Are you sure, though, that you need FSO? There's extremely little that FSO
can do that you can't already do in VBA.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

Jan 15 '06 #4
No reason for FSO then. The following VBA code will read a file line by line
into variable strBuffer.

Dim intFile As Integer
Dim strBuffer As String
Dim strFile As String

strFile = "C:\My Folder\MyFile.h tml"

intFile = FreeFile()
Open strFile for Input As #intFile
Do While Not EOF(intFile)
Line Input #intFile, strBuffer
' strBuffer now contains a line of data: work with it

Loop

Close #intFile

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"John" <Jo**@nospam.in fovis.co.uk> wrote in message
news:Wa******** ************@pi pex.net...
I am just trying to read an html file from disk.

Thanks

Regards

"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
"RoyVidar" <ro************ *@yahoo.no> wrote in message
news:mn******** *************** @yahoo.no...
John wrote in message <OL************ **@TK2MSFTNGP11 .phx.gbl> :
Hi

I am getting the 'User defined type not defined' on the line;

Dim fso As Scripting.FileS ystemObject.

What am I doing wrong? What reference do I need to add? Do I need to
install/enable scripting on the win xp sp2 machine?

Thanks

Regards

The reference, I think, is Microsoft Scripting Runtime (in VBE - Tools |
References), or try late binding.


To use Late Binding (which would be my vote if you have to use FSO),
you'd use

Dim fso As Object

Set fso = CreateObject("S cripting.FileSy stemObject")

Note that when you use Late Binding, any intrinsic constants defined by
the Scripting library are unavailable to you: you either need to define
the constants yourself, or replace them by the actual value of the
constant. For example, you couldn't use:

Dim fso As Object
Dim f As Object
Dim ts As Object

Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFile("te st1.txt")
Set ts = f.OpenAsTextStr eam(ForWriting, TristateUseDefa ult)

You'd either have to include a line:

Const ForWriting = 2, TristateUseDefa ult = -2

or rewrite the code as

Dim fso As Object
Dim f As Object
Dim ts As Object

Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFile("te st1.txt")
Set ts = f.OpenAsTextStr eam(2, -2)

Are you sure, though, that you need FSO? There's extremely little that
FSO can do that you can't already do in VBA.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


Jan 15 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
16648
by: o'seally | last post by:
solaris/linux admins/rookie_developers that battle with this error are probably all frustrated when it happens. i bet you're also somehow frustrated by this seemingly unsolvable error :-) ...take it easy, it'll go away once u've learned how to play around with a few things on your system and reorganised. i'm particulary a solaris junkie, but linux is my admiration. the issue here is Not the OS/Software, but rather the concept. first of all...
2
3959
by: Cigdem | last post by:
Hello, I am trying to parse the XML files that the user selects(XML files are on anoher OS400 system called "wkdis3"). But i am permenantly getting that error: Directory0: \\wkdis3\ROOT\home Canonicalpath-Directory4: \\wkdis3\ROOT\home\bwe\ You selected the file named AAA.XML getXmlAlgorithmDocument(): IOException Not logged in
11
3094
by: Skc | last post by:
I have a .txt which has been exported as a .csv from an external source. What i need to do is to import this into SQL2000 (into a table) but I need to do special things on the data: 1. I need to look for the first three chars and import rows into separate tables. E.g. if the first three chars begin with CCC, then this row goes into the CCC_table, if it is TTT then into the TTT_table etc... 2. Once I have my tables built up, I need to do...
3
12181
by: Michael Bøcker-Larsen | last post by:
Hi I'v been stuck on this problem for ages now. I have found that I'm not the only one with this problem, by looking through the different newsgroups. Hope you can help me! I know there is a lot of information, but if you need more (e.g. the code) please write michael@mblarsen.dk. The problem is this error messages (the code is build just fine; no errors):
13
4324
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming that this is suppossed to end up as a component for others to use, and therefore I do NOT have access to their global.cs::Session_End() how do I cleanup files that were uploaded -- but obviously left stranded when the users aborted/gave up writting...
2
2657
by: Anna | last post by:
I added a small Web.Config file to the root of my website so that I could view errors on a machine other than the server: <configuration> <system.web> <customErrors mode="Off" /> </system.web> </configuration> However, this immediately threw a different error when I tried to view
6
4138
by: tshad | last post by:
I have an upload file input as: <input id="MyFile" style="width:300px" type="File" runat="Server"> This works fine, but I find that if my page doesn't pass validation during postback, the page comes back with all the data intact, except for the upload object. The text box for "MyFile" (my example) is always cleared. Why is that and is there a way to stop that from happening? Thanks,
8
9764
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my problem: my vb.net program has problems with UNC. If the UNC server is restarted or goes off-line, my VB.net program crashes. The code for UNC access to the file is included below and is put in the tick event of a form timer control running every...
1
5723
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out of a Microsoft book, "Visual Basic,Net Step by Step" in Chapter 18. All but the bottom two subroutines will open a text file, and then allow me to use the above controls, example 1. The bottom two subroutines will print a graphic file, example...
2
151660
by: antonyliu2002 | last post by:
I am testing AJAX. I've downloaded the AJAX Extension and the CTP December package and installed on BOTH my development machine and the production server. Then I created a very very simple web application, which contains a button and a label. When the button is clicked, some message is shown on the label. That's it. The AJAX works great on my development machine, but on the production server, I got the typical error as follows:
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10443
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10002
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7543
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6783
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2921
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.