There is some extra stuff in here that I'll remove in the final product.
Thanks,
Here's the code;
[tt]
Private Sub cmdOpen_Click()
Dim FileName As String
Dim fso As New Scripting.FileSystemObject
Dim fil As Scripting.File, ts As Scripting.TextStream
Dim pos As Long, count As Long, strCurrentLine As String
'This function is copied from Balena, "Programming Visual Basic 6.0"
FileName = LoadTextControl(StringToSearch, CommonDialog1, "Olgio output"
If IsEmpty(FileName) Then
MsgBox "Unable to open file"
Exit Sub
End If
Me.txtFileName = FileName
Set fil = fso.GetFile(FileName)
'Set ts = fil.OpenAsTextStream(ForReading)
FindGeneNameLine (fil) 'See below
End Sub
__________________________________________________________
Public Function FindGeneNameLine(filCurrent As Scripting.File)
Dim ts As Scripting.TextStream
Dim pos As Long, count As Long, strCurrentLine As String
Set ts = filCurrent.OpenAsTextStream
'Read the file -line by line- until you find the line
'Can I pass the file object?
With ts
Do Until .AtEndOfStream
strCurrentLine = .ReadLine
If strCurrentLine Like ">*" Then
Me.StringToSearch = "Line #" & .Line & " " & strCurrentLine
Exit Function
End If
Loop
End With
End Function
[/tt]