[RESOLVED] Creating Text Files From Excel's VBA
So, (with some help, thx Si) I've successfully used the code below to create Text files from Excel's VBA. I have a new problem though.
How do I pass more than one line of text to the file?
Ideally I'ld like to be able to pass an ENTER keystroke(within "myString") and continue sText (myString) on a new line.
VB Code:
Dim sFile As String
Dim sText As String
Dim iFileNum As Integer
sFile = "C:\(path)\Textfile.txt"
sText = "myString"
iFileNum = FreeFile
Open sFile For Output As iFileNum
Print #iFileNum, sText
Close #iFileNum
Re: Creating Text Files From Excel's VBA
Each print statement will end with a new line.
VB Code:
Open sFile For Output As iFileNum
Print #iFileNum, sText
Print #iFileNum, "More text on next line"
Print #iFileNum, "Etc."
Close #iFileNum
Re: [RESOLVED] Creating Text Files From Excel's VBA
Wow That was fast! Thanks for the help. Worked great.