Creating Strings from Text File

K

kensworld2

I need some help with text files.

My company regularly retrieves a text file from it's customers that
contains 5 lines. The first 4 are header info. The 5th line is 1481
characters long. It is made up of settings for the software we sell
so that we may easily see where a potential problem might be. Since
the data already exists in the text file I didn't want to store it
permanently in an MDB. I would like to read the 5th line into a
string and use the MID Function to display it in a form that the
software support folks can understand. Then when the support folks
want the latest data they can simply re-display the most current data
when neccessary. The file name is the customers number i.e.
123456.txt


I can't seem to find a way to skip the first 4 lines and worse yet (I
know.. I know) how to capture the string so I may manipulate it.

I really just need a place to start. Any and all help will be greatly
appreciated.

Thanks in advance

Ken Brown
(e-mail address removed)
 
D

Douglas J. Steele

Dim intFile As Integer
Dim intLoop As Integer
Dim strFile As String
Dim strBuffer As String

strFile = "fullpath to file"
intFile = FreeFile
Open strFile For Input As #intFile
' Read the first 4 lines, but do nothing with them
For intLoop = 1 to 4
Line Input #intFile, strBuffer
Next intLoop
Line Input #intFile, strBuffer
Close #intFile


' strBuffer now holds the contents of the 5th line of the file
' Go crazy!
 

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