Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RUN TIME ERROR 62 : Input Past End of File?

Status
Not open for further replies.

dmoonme

MIS
Jul 21, 2004
33
US
I am a newbie to VBA for Word. I am writing a script that parses info into a text file. The source file is a .doc file which after parsed is stored in a txt file. I keep getting this run time error 62: input past end of file.

Here is the part of the code where the error occurs.

Do While Not EOF(FF) And Not (lAuthor = 1) Or (lLocation = 1) Or (lBody = 1)
Line Input #FF, sCurrentLine

The complete code is at:
 
Code:
Do While Not EOF(FF) And Not (lAuthor = 1) Or (lLocation = 1) Or (lBody = 1)
Line Input #FF, sCurrentLine

What exactly do you want this to do?
Code:
finsihed=false
Do while not EOF(FF) and Not(Finished)
  Line Input #FF, sCurrentLine
  if lAuthor=1 or lLocation=1 or LBody=1 Then
    finished = True
  end if
end while|do #can't remember syntax for this

Another thing to check is that chr(26) isn't present in your file, because that's intepreted as the EOF signal

HTH
--Paul


It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Do While Not EOF(FF) And Not (lAuthor = 1) Or (lLocation = 1) Or (lBody = 1)
ALWAYS use parens when mixing And & Or in logical expressions !
Have you tried this ?
Do While Not EOF(FF) And Not (lAuthor = 1 Or lLocation = 1 Or lBody = 1)
Or this ?
Do While Not EOF(FF) And lAuthor <> 1 And lLocation <> 1 And lBody <> 1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top