Option Explicit
Private Sub Form_Load()
Dim sLine As String
Dim sFileName As String
Dim FF As Integer
Dim pos As Long
Dim bMotor As Boolean
sFileName = App.Path & "\H000277.txt"
FF = FreeFile
Open sFileName For Input As #FF
Do Until EOF(1)
Line Input #FF, sLine
If Not bMotor Then
If InStr(1, sLine, "Motor Controller Module:", vbTextCompare) Then
bMotor = True
End If
End If
Parse sLine, "Data file:", m_Data.DataFile
Parse sLine, "Date:", m_Data.Date
Parse sLine, "Model:", m_Data.Model
If bMotor Then
Parse sLine, "Software Version:", m_Data.MotorVersion
Else
Parse sLine, "Software Version:", m_Data.MainVersion
End If
Parse sLine, "Sudden Press. Rise", m_Data.SuddenPressRise
Loop
Close FF
Debug.Print "DataFile:", m_Data.DataFile
Debug.Print "Date:", m_Data.Date
Debug.Print "Model:", m_Data.Model
Debug.Print "Main Software Version:", m_Data.MainVersion
Debug.Print "Motor Software Version:", m_Data.MotorVersion
Debug.Print "SuddenPressRise", m_Data.SuddenPressRise
End Sub
Private Sub Parse(ByVal sLine As String, ByVal sFind As String, item)
Dim pos As Long
pos = InStr(1, sLine, sFind, vbTextCompare)
If pos Then
item = Trim(Mid(sLine, pos + Len(sFind)))
End If
End Sub
|