View Single Post
 
Old 06-09-2012, 08:30 AM
tinfanide tinfanide is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Error: Input past end of file

Code:
Sub pdf()

Const sFile As String = "C:\test\1.pdf"
Const oFile As String = "C:\test\1.log"
Dim m, n As Integer
Dim str As String

m = FreeFile()
Open sFile For Binary As m
n = FreeFile()
Open oFile For Output As n
Do While Not EOF(m)
    Line Input #m, str
    Print #n, str
Loop

''' error
''' Input past end of file
Close m
Close n

End Sub
With the above codes, I want to write the binary data into a new log file for the purpose of counting the pages of the pdf file (m).
It runs as expected but fails before closing the n file (log file).
Reply With Quote