Creating Output Text File with Unique Name
Posted on 2002-04-05
I need very simple explanations. I am experimenting with VB and can get easily confused.
I am creating a simple app that creates a text file for me. I am trying to figure out how to get my app to create a filename via my input rather than hard coding the filename. I tried to use the following but it just prints everything between the quotes. Do you have a suggestion on how to do this? As you will see, the OPEN command is erroneous. I would like to put the value in a text box and then have that be the filename.
Private Sub Command1_Click()
Dim IntFile As Integer
IntFile = FreeFile
Open "C:\Batch\Dat\(Text1.Text).DAT" For Append As #IntFile
Print #IntFile, "ConvertType=" & CStr(Combo1.Text)
Print #IntFile, "ConvertFrom=" & CStr(Combo2.Text)
Print #IntFile, "ConvertTo=" & CStr(Combo3.Text)
Print #IntFile, "FromDatabase=" & CStr(Text2.Text)
Print #IntFile, "FromUserID=" & CStr(Text3.Text)
Print #IntFile, "FromPassword=" & CStr(Text4.Text)
Print #IntFile, "FromChecked=" & CStr(Text5.Text)
Print #IntFile, "ToDatabase=" & CStr(Text6.Text)
Print #IntFile, "SearchValue=" & CStr(Text7.Text)
Print #IntFile, "Convert=" & CStr(Combo4.Text)
Print #IntFile, "Start"
Eventually, I want to add browsing capability that will ask for the source file. The FromDatabase would be the default property for the ToDatabase and for the Text filename. For instance, if my FromDatabase filename is ABC.NSF the Output filename would be ABC.PST and the text file would be named ABC.DAT.
Thank you in advance,