I've got a logging program which I've purchased logging to a .log file which is really a .csv text file. Every 10 seconds this logging app adds a new row to the .log text file with the last snap shot of data from a PLC. I've recorded a macro to import this .log file into a excel sheet (see the code for this is below). This works ok and I get all the data from the .log file into my excel sheet. What I really want to do is to only import the last row of the .log file. Is there an easy way of modifying the code below to do this. Is there a way of couting the rows in this file before running the query and then using this value as the .TextFileStartRow property.

Thanks in advance for any help given.

Richard Goforth

Sub Get_Todays_Log()
'
' Get_Todays_Log Macro
' Macro recorded 01/10/2005 by R Goforth
'

'
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\L OG FILES\091605.log", _
Destination:=Range("A1"))
.Name = "Get_log_file"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.Refresh BackgroundQuery:=False
End With
End Sub