Thats a bit odd... try the Open statement instead. Here's an example:
Dim I, FileName
For I = 1 To 3 ' Loop 3 times.
FileName = "TEST" & I ' Create file name.
Open FileName For Output As #I ' Open file.
Print #I, "This is a test." ' Write string to file.
Next I
Close ' Close all 3 open files.
The important lines are Open, Print and Close.
Look in the help file for the open statement as there are a few options to opening the file.
Sub OpenTextFileTest
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\testfile.txt", ForAppending,TristateFalse)
f.Write "Hello world!"
f.Close
End Sub
Vba commands used to connect to sql
RobKinney1
NicMilne
Thats a bit odd... try the Open statement instead. Here's an example:
Yes!
HI,
Use the FileSystemObject...
ManServ
i've tried the commands and it works...
thnx again for being so kind in giving us new ideas....