Hello, Troy.
If you know the string you want to retrieve, you can open the file
as Line Input, and search each line for your string. There are
a number of ways of searchiing for your string. The way I am used
to doing this string-handling:
Dim FindWhat1 As String
Dim FindLen1 As Integer
FindLen1 = Len(FindWhat1)
Dim Msg1 As String
Dim FNum As Integer
FNum = FreeFile
FindWhat1 = "This is the string I am looking for"
fname = "c:\files\x.dat"
Open fname For Input As #(FNum)
Do While Not EOF(FNum)
Line Input #(FNum), Char
Msg1 = Left$(Char, FindLen1) 'The left-most characters, of
the
'length you are looking for.
If FindWhat1 = Msg1 Then
'A Match. Msg1 becomes your variable
MyVariable = Msg1
End If
Loop
Close #(FNum)
This procedure always looks at the cascading ASCII text, in this case,
those characters always to the left of each line. You can easily change
this arrangement to right, or even character by character, rather than
line by line. You can increment a number for each line, and mark its
location that way. I hope this is what you were asking.
Regards,
David
Quote:
> I have been able to create a data file with the Open "x.dat" For Append
> as vFileNum using a print # command to write to the data file and using
> the old Input LOF concept I can get the entire contents of the file read
> from the data file. I am not, however, able to read just one item. I've
> tried changing the print command to Write # and use Input. Ive also
> tried Line INput# but no matter what filenumber I use, I always get the
> first string in the list returned. How can I get any string in the list
> returned to a variable?