How do I export a to a text file not using TransferText

B

Bright

I am trying to export data from a form to a text file, but I must sort
the fields before exporting them, as in the first field to be the first
line and the second field to be start on the next line on the text file
and with TransferText I can not accomplish that. please help me with
the coding of exporting the data.

Thanks a million.
 
J

John Nurick

This snippet shows how to open a file and write stuff to it:

Dim FileSpec As String
Dim lngFN As Long
Dim strLine As String

FileSpec = "D:\Folder\File.txt"

lngFN = FreeFile()
Open FileSpec For Output As #lngFN

strLine = "Contents of first line"
Print #lngFN, strLine

strLine = "Contents of next line"
Print #lngFN, strLine

...

Close #lngFN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top