+ Reply to Thread
Results 1 to 3 of 3

on error goto

Hybrid View

RBI on error goto 10-10-2008, 10:25 AM
BigBas I had this problem too. ... 10-10-2008, 10:32 AM
RBI Thnks 10-10-2008, 11:42 AM
  1. #1
    Registered User
    Join Date
    09-13-2008
    Location
    Barrie, ON, CA
    Posts
    47

    on error goto

    hello,

    I'm using a on error goto approach, heres the code.

    On Error GoTo ErrorHand
      Windows("book1").Activate
    ErrorHand:    MsgBox "Please download JDE Report, Save it as book1, And Run Macro Again", , "Warning!": Exit Sub
    My problem is that the ErrorHand runs even when there is no error. I think its because of it's positioning in the code but i still can't fix it...

    Anyone?
    Last edited by RBI; 10-10-2008 at 11:42 AM. Reason: mark as solved

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    I had this problem too. Errorhandler should in theory be the last line in your code, and should be preceded by Exit Sub.

    ie,

    Sub NewBook()
    On Error GoTo ErrorHand
          Windows("book1").Activate
          'Enter All your Code here
        Exit Sub
    ErrorHand:    MsgBox "Please download JDE Report, Save it as book1, And Run Macro Again", , "Warning!": Exit Sub
    End Sub

  3. #3
    Registered User
    Join Date
    09-13-2008
    Location
    Barrie, ON, CA
    Posts
    47

    Thnks

    oh yeah aha guess that makes sense... thnks for the 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