Create and write a simple text file in Excel/VBA
Dim F1 As Integer
F1 = FreeFile
Open "fullpathname\filename.txt" For Output As F1
Print #F1, "Test line" 'Prints: Test Line
Print #F1, yourvariable 'Prints: the value of your variable
Print #F1, "The vaue of yourvariable is: " & yourvariable 'Prints: the
concatation of "quoted" and yourvariable
Close #F1
F1 = 0
Thomas Wieser wrote:
Hi,
what is the easiest way to create a new text file, write one string into
the file and close it afterwards?
Regards, Thomas
|