I should have noted that if you open the file for Output, the existing
contents of the file are destroyed. To keep the existing content, open for
Append:
Open FName For Append Access Write As #FNum
This will cause the data to be written at the end of the existing contents.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
"Chip Pearson" wrote in message
...
Try code like the following to get started:
Dim FName As String
Dim FNum As Integer
Dim S As String
FName = "C:\Test\TestFile.txt"
FNum = FreeFile
S = "Write This"
Open FName For Output Access Write As #FNum
Print #FNum, S
Close #FNum
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
"JohnJ" wrote in message
...
Is there any Excel VBA code to save strings to a text file?