Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 How to create a text file in VB6

Author  Topic 

Mamatha
Posting Yak Master

102 Posts

Posted - 2005-02-11 : 06:12:01
Hi
I want to create and write a text file using file system object in VB6.
How can i do this.
I tried some code,but it gives error while creation.
Dim Fso As New FileSystemObject
Dim txtfile As File
Dim txtstream As TextStream

txtfile = Fso.CreateTextFile("D:\desktop.txt")
txtstream = txtfile.OpenAsTextStream("D:\desktop.txt", 2)
txtstream.WriteLine ("hello")
txtstream.Close
Fso = Nothing
But i got an error,obect variable or block variable not set.

Please give me solution

Mamatha

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-02-11 : 08:38:12
You need to Set txtfile and txtstream, they are object references.

i.e.

Set txtfile = Fso.CreateTextFile("D:\desktop.txt")



Damian
Go to Top of Page
   

- Advertisement -