Call OpenFile(StrFileName, BoolOpenSuccess)
Application.ScreenUpdating = False
If BoolOpenSuccess = False Then
Exit Sub
End If
'open file for input
Open StrFileName For Input As #5
Do While Not EOF(5)
On Error Resume Next
Line Input #5, strLine
'Get stepsize info
If BoolGetWidth = False Then
If InStr(1, strLine, "Pulse width:") > 0 Then
BoolGetWidth = True
If InStr(1, strLine, "ns") > 0 Then
'Pulse width
'Format: Pulse width:100ns
pos1 = InStr(1, strLine, ":")
pos2 = InStr(pos1, strLine, "s")
Value = Mid(strLine, pos1 + 1, pos2)
'store value in sheet
Worksheets("Result").Range("C10") = Value
Exit Do
End If
End If
End If
Loop
'close file
Close #5
End Sub
Sub OpenFile(strTemp, BoolOpenSuccess)
strTemp = Application.GetOpenFilename("All Files (*.*), *.*)")
If strTemp = False Then 'user chooses cancel
MsgBox "File Open Failed, Exit"
BoolOpenSuccess = False
Exit Sub
Else
BoolOpenSuccess = True
End If
End Sub