+ Reply to Thread
Results 1 to 2 of 2

VB handling on mdi print error code 1004

  1. #1
    Walter L. skinner
    Guest

    VB handling on mdi print error code 1004

    I am attempting to automatically print an mdi format file from Excel. When
    the save menu asks for a name or cancel option, my visual basic program fails
    with error code 1004 even though I have an on error statement. How do you
    trap the cancel selection from the menu to avoid the vb program from quiting
    with an error. When I use the On Error when attempting to print a PDF file
    and the user selects cancel, it traps the error and the vb program continues
    on to the GoTO address.

    Thanks for any help.

  2. #2
    Jim Rech
    Guest

    Re: VB handling on mdi print error code 1004

    >>When I use the On Error when attempting to print a PDF file and the user
    >>selects cancel, it traps the error and the vb program continues on to the
    >>GoTO address.


    Every error handler must have a Resume statement associated with it. So (if
    I understand you) when the user cancels your code jumps to your error
    handler. In the error handler you have a Goto. That won't fly. Use Resume
    instead of the Goto:

    On Error Goto ErrHandler
    ''Potential error causing code
    ''other code
    ResumeHere:
    ''other code
    Exit Sub
    ErrHandler:
    ''do stuff
    Resume ResumeHere

    --
    Jim
    "Walter L. skinner" <[email protected]> wrote in
    message news:[email protected]...
    |I am attempting to automatically print an mdi format file from Excel. When
    | the save menu asks for a name or cancel option, my visual basic program
    fails
    | with error code 1004 even though I have an on error statement. How do you
    | trap the cancel selection from the menu to avoid the vb program from
    quiting
    | with an error. When I use the On Error when attempting to print a PDF file
    | and the user selects cancel, it traps the error and the vb program
    continues
    | on to the GoTO address.
    |
    | Thanks for any help.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1