Rob...
Lifetime Supporting Member
Been scratching my head at what I thought should be a relatively simple task.
I need to count how many rows a .csv file has, so I can later read data from the last row.
I have everything working, bar that. This is the VBS code I have so far to count the rows:
Now this actually works, and produces the value I need. However, it throws Error 438 :- Object doesn't support this property or method.
Anyone see where I'm going wrong, or have a better solution?
Next will be to write it to also work with WinCE, but i'll cross that hurdle later.
I need to count how many rows a .csv file has, so I can later read data from the last row.
I have everything working, bar that. This is the VBS code I have so far to count the rows:
Code:
Set fso = CreateObject("Scripting.FileSystemObject")
fc = fso.OpenTextFile((Source),1,1).ReadAll
RowArray = Split(fc,vbCrLf)
NumberOfRows = CInt((UBound(RowArray)))
If NumberOfRows = 0 Then
NumberOfRows = 1
End If
fso.close
Now this actually works, and produces the value I need. However, it throws Error 438 :- Object doesn't support this property or method.
Anyone see where I'm going wrong, or have a better solution?
Next will be to write it to also work with WinCE, but i'll cross that hurdle later.