davesmith202
Employee of Access World
- Local time
- Today, 19:09
- Joined
- Jul 20, 2001
- Messages
- 522
I have the following code to import a text file, with a counter to show the progress.
This works fine, except I do not know how many lines it has to go through.
How can I find out the total number of lines in the text file, so I can then do...
Me.txtCount1 = CStr(x) & "/" & NoOfTextLines
Thanks,
Dave
Code:
Public Function GetMyFile(pathToFile As String)
Dim fileNum As Integer
Dim myString As String
Dim myTotalString As String
fileNum = FreeFile
Open pathToFile For Input As #fileNum
x = 0
Do Until EOF(fileNum)
x = x + 1
Line Input #fileNum, myString
myTotalString = myTotalString & myString & vbCrLf
Me.txtCount1 = CStr(x) & "/"
a = DoEvents()
Loop
Close #fileNum
GetMyFile = myTotalString
End Function
This works fine, except I do not know how many lines it has to go through.
How can I find out the total number of lines in the text file, so I can then do...
Me.txtCount1 = CStr(x) & "/" & NoOfTextLines
Thanks,
Dave