Open "path\filename.log" For Input As #1 Error

My open statement is no longer working.  The path and filename are both correct.

MsgBox ("SETTING cLogin")
    Set cLogin = New Collection
MsgBox ("cLogin SET SUCCESSFULLY")
MsgBox ("OPENING LOG FILE")
    Open "\\path\filename.log" For Input As #1
MsgBox ("LOG FILE OPENED SUCCESSFULLY")

I put in the MsgBoxes to localize the problem and it executes MsgBox ("OPENING LOG FILE") and then stops running.  It never reaches the MsgBox ("LOG FILE OPENED SUCCESSFULLY") statement.  I'm fairly new to VB but as far as I can tell the syntax is fine. 



Answer this question

Open "path\filename.log" For Input As #1 Error

  • J. Shen

    Ahhh than you are getting an exception and the On Error statement is trapping it.

    What version of visual studio are you running (Help | About).

    You will get more information if you comment out the On Error statement... I promise that.

    Since I don't know what version of VS you are running, it's difficult to recommend a proper open statement. The code you have supplied is code that is made to deal with earlier errors, I believe.


  • gotit

    The code was already written.  I just added the MsgBox statements.  Therefore I'm not sure what version it is.  And when it stops running I get the user defined error message which was also already coded. => On Error GoTo EmailUpdate_Err

  • cs466

    SOLVED!
  • jfalberg

    This appears to be VB6 code.

    Did you convert this code to vb2005 via a wizard or did you just cut and paste it

    When you say it stops running, do you get an execution time exception or what There is no longer a set command in vb2005. The token only exists in property declarations.

  • ProfVet

    Care to let other know what the solution was....

     


  • Open "path\filename.log" For Input As #1 Error