export string to text file (1 Viewer)

SunWuKung

Registered User.
Local time
Today, 14:32
Joined
Jun 21, 2001
Messages
172
hi,
could somebody tell me what is the syntax for exporting the content of a string variable into a text file?

thanks
SWK
 

Bat17

Registered User.
Local time
Today, 14:32
Joined
Sep 24, 2004
Messages
1,687
look up "open" in VBA help

peter
 

SunWuKung

Registered User.
Local time
Today, 14:32
Joined
Jun 21, 2001
Messages
172
Yep,
thanks for the help. This is the code I took from the help:

Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fs, f, ts, s
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile FileName 'Create a file
Set f = fs.GetFile(FileName)
Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
ts.Write PrintStr
ts.Close
 

Users who are viewing this thread

Top Bottom