-
January 8th, 2013, 03:37 AM
#1
object required error for Scripting.FileSystemObject
am getting runtime error 424-object required on the bold line of following code:
****Dim fs, fname
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set fname = fs.CreateTextFile("D:\vb\myfile.txt", True)
fname.WriteLine ("something")
fname.Close
Set fname = Nothing
Set fs = Nothing*****
which object can possibly be required?any help?
thank you in advance...
-
January 8th, 2013, 10:26 AM
#2
Re: object required error for Scripting.FileSystemObject
Is this ASP code or VB6?
If it is VB6 then I would advise not using the FSO at all. There is no need for it, the built in functions for file I/O work much better and take fewer resources.
As for the object message, clearly it is referring to the FSO
Always use [code][/code] tags when posting code.
-
January 8th, 2013, 01:48 PM
#3
Re: object required error for Scripting.FileSystemObject
If you get the Object required error, I'd think that the name "Server" is not defined.
Find out which object the name Server refers to. Maybe this object is not available within the scope of your code.
-
January 8th, 2013, 09:41 PM
#4
Re: object required error for Scripting.FileSystemObject
That is why I asked if it was ASP. Sever.CreateObject would be the common method when writing VB script as part of an ASP page but would not be used in a VB6 app.
Always use [code][/code] tags when posting code.
-
January 9th, 2013, 12:11 AM
#5
Re: object required error for Scripting.FileSystemObject
Found this code in ASP file system tutorial and added it to a vb 6.0 program to write a text file during runtime.i now add the references --> microsoft scripting runtime, microsoft scriptlet library and microsoft script control.And changed the bold line into:
Code:
Set fs = New FileSystemObject
now its working....no error...
-
January 9th, 2013, 12:12 AM
#6
Re: object required error for Scripting.FileSystemObject
thank you so much for your response....
-
January 9th, 2013, 10:40 AM
#7
Re: object required error for Scripting.FileSystemObject
Fine. That's what I thought.
I dont know much about ASP, but when creation of an object fails you get a different error like "cannot create object".
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|