I am having difficulty getting my Excel VBA program to recognize a tilde. I search for the string "~Ascii" in the first 6 characters of a line, but VBA won't find it, even though I am certain the line exists. My code is:
Do While Not EOF(1) ' Loop until end of file.
Line Input #1, LineString ' Read line into variable.
iLoc1 = (InStr(LineString, ".")) + 1
iLoc2 = (InStr(LineString, ":")) - 1
iLoc3 = iLoc2 - iLoc1
If iLoc3 <= 0 Then GoTo NextLoop
NewLine = Mid(LineString, iLoc1, iLoc3)
NewLine = Trim(NewLine)
If Mid(LineString, 1, 6) = "~Ascii" Then
MsgBox (LineString)
End If
I never get anything echoed to the screen. Is there some secret about searching for the tilde?
Thanks,
Paul H.
Denver
Do While Not EOF(1) ' Loop until end of file.
Line Input #1, LineString ' Read line into variable.
iLoc1 = (InStr(LineString, ".")) + 1
iLoc2 = (InStr(LineString, ":")) - 1
iLoc3 = iLoc2 - iLoc1
If iLoc3 <= 0 Then GoTo NextLoop
NewLine = Mid(LineString, iLoc1, iLoc3)
NewLine = Trim(NewLine)
If Mid(LineString, 1, 6) = "~Ascii" Then
MsgBox (LineString)
End If
I never get anything echoed to the screen. Is there some secret about searching for the tilde?
Thanks,
Paul H.
Denver