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).