Name: Anonymous 2011-06-02 0:37
Is there a way of creating a text file based on a variable?
Dim fso, MyFile
Dim fname As String
fso = CreateObject("Scripting.FileSystemObject")
MyFile = fso.CreateTextFile("c:\address\fname.txt", True)
MyFile.WriteLine(TextBox1.Text)
MyFile.WriteLine(TextBox2.Text)
MyFile.WriteLine(TextBox3.Text)
MsgBox("File Created!")
MyFile.Close()
Example
basically i want to use textbox1.text as the filename, instead of declaring the filename in MyFile
Dim fso, MyFile
Dim fname As String
fso = CreateObject("Scripting.FileSystemObject")
MyFile = fso.CreateTextFile("c:\address\fname.txt", True)
MyFile.WriteLine(TextBox1.Text)
MyFile.WriteLine(TextBox2.Text)
MyFile.WriteLine(TextBox3.Text)
MsgBox("File Created!")
MyFile.Close()
Example
basically i want to use textbox1.text as the filename, instead of declaring the filename in MyFile