Im using excel to parse some data sets from a file... The code i am using below has me select the same file two different times .. Trying to find a way to select the file just once....
Thanks
Sub ACV_ImportRawACV10File()
'needs to be on ACV10 tab
Sheets("ACV10").Select
Dim fn As String, x, e, n As Long
fn = Application.GetOpenFilename("LogFiles,*.log")
If fn = "False" Then Exit Sub
x = Split(CreateObject("Scripting.FileSystemObject").OpenTextFile(fn).ReadAll, vbLf)
For Each e In x
'items need to be in quotes followed by stars
If e Like "* start time: *" Then
n = n + 1: Cells(n, 1) = e
ElseIf e Like "* COMPLETED end time: *" Then
Cells(n, 2) = e
End If
Next
End Sub
Sub ACV_ImportRawACV10_2File()
'needs to be on ACV10_2 tab
Sheets("ACV10_2").Select
Dim fn As String, x, e, n As Long
fn = Application.GetOpenFilename("LogFiles,*.log")
If fn = "False" Then Exit Sub
x = Split(CreateObject("Scripting.FileSystemObject").OpenTextFile(fn).ReadAll, vbLf)
For Each e In x
'items need to be in quotes followed by stars
If e Like "*Total time (milliseconds) taken by job*" Then
n = n + 1: Cells(n, 1) = e
ElseIf e Like "*Total records processed:*" Then
Cells(n, 2) = e
End If
Next
End Sub
Bookmarks