1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
Dim iFileID As Integer
Dim lFileLen As Long
Dim lSizeCount As Long
Dim sLine As String
lSizeCount = 0
ProgressBar1.Max = 100
iFileID = FreeFile ' get next free file id
Open "MyFile.txt" For Input As iFileID
iFileLen = Lof(iFileID) ' get the length of the file
Do
Line Input #iFileID, sLine ' read the next line
lSizeCount = lSizeCount + Len(sLine) ' count the number of characters processed
ProgressBar1.Value = 100 * Int(lSizeCount / lFileLen) ' set the progressbar
Loop Until Eof(iFileID)
Close iFileID |