Consulting

Results 1 to 7 of 7

Thread: On Error Help

  1. #1

    On Error Help

    I am trying to get this to work and for some reason can't figure it out. If there is an error I want the sub to end/exit. I am implimenting a msg box as well and I can get it to work partially. The msg box is displayed but you have to click ok 20 times before it will close... I want it to display the box once and thats it.. LOL I can use the on error resume next, but like I said, it shows the msg box too many times.. Any ideas?

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You can try something like this:


    Sub Macro1()
    'Your Variable Declarations Here
    On Error Goto ErrorHandler:
    'Your Code Here
    On Error Goto 0
    Exit Sub
    ErrorHandler:
    MsgBox "There was an error blah blah blah..."
    End Sub

  3. #3
    Thank you very much!!

  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You're Welcome

    Take Care

  5. #5
    If you could assist me on my other problem that would be WONDERFUL!! I am about to pull my hair out with it.

  6. #6
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    What's the problem?

  7. #7
    Your already there.. Thanks!!

Posting Permissions

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