I am having an issue importing specific text from a lengthy log file. I can get it to find and return the correct results but it stops after the first match. I need it to go thru the entire file and return all relevant results in each column.
Private Sub CommandButton1_Click()
Dim myFile As String, text As String, textline As String, posIP As Integer, posUser As Integer
myFile = Application.GetOpenFilename()
Open myFile For Input As #1
Do Until EOF(1)
Line Input #1 , textline
text = text & textline
Loop
Close #1
posLat = InStr(text, "New client connection opened for")
posUser = InStr(text, "Trying to authenticate user-")
Range("A2").Value = Mid(text, posLat + 32, 15)
Range("B2").Value = Mid(text, posUser + 28, 5)
End Sub
Private Sub CommandButton1_Click()
Dim myFile As String, text As String, textline As String, posIP As Integer, posUser As Integer
myFile = Application.GetOpenFilename()
Open myFile For Input As #1
Do Until EOF(1)
Line Input #1 , textline
text = text & textline
Loop
Close #1
posLat = InStr(text, "New client connection opened for")
posUser = InStr(text, "Trying to authenticate user-")
Range("A2").Value = Mid(text, posLat + 32, 15)
Range("B2").Value = Mid(text, posUser + 28, 5)
End Sub