VBA code to Paste into a specific text file
Something like this should do what you want:
Sub SaveToTextAppend(strFullPath As String, strText As String)
Dim hFile As Long
hFile = FreeFile
Open strFullPath For Append As hFile
Print #hFile, strText
Close #hFile
End Sub
Sub test()
SaveToTextAppend "C:\testfile.txt", "just testing appending some text"
End Sub
Keep in mind that if the file doesn't exist it will be made, so if you don't
want
that you will have to test for the presence of the file first.
RBS
"dcozzi" wrote in message
...
I have a macro that i run. The last part is to copy the data.
I then click over to an open text document and paste where the curser is,
which is at the bottom of the most recient data pasted.
Is there a way to have excel automatically, paste/export/whatever into a
specific text doc saved on my HD. I have to do this hundreds of times to
compile and any step i can automate is helpful.
Thanks.
|