Results 1 to 4 of 4

Thread: Error propagation in vba

  1. #1
    Join Date
    Mar 2009
    Posts
    89

    Error propagation in vba

    Hello friends,

    I am facing an issue in Excel whenever i am trying to call any sub function it is expected that the error will propagate through to error handling of
    MySub. But apparently that is not happening.

    Can anyone help me out with this issue.

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Error propagation in vba

    Definitely i will help you out it would be more helpful if you can provide me the code in which you are getting this error.

  3. #3
    Join Date
    Mar 2009
    Posts
    89

    Re: Error propagation in vba

    Here goes the code

    Code:
    Private MySub()
       On Error GoTo ErrTrap
       Sub1
       Sub2
    
    Exit sub
    
    ErrTrap:
    If Err.Number = 18 Then
        MsgBox "Error 10"
      Else
        MsgBox "Error 20"
    End If
    
    
    End
    Over here Sub1 and Sub2 do not contain any error handling but my exception was even if user gets an Error 18 and is user press Esc button he should go through error handing of MySub.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Error propagation in vba

    As i can see that you need to add one lince of code which you can insert it anywhere before you call the subs.

    Code:
    Application.EnableCancelKey = xlErrorHandler

Similar Threads

  1. Replies: 6
    Last Post: 12-11-2010, 11:37 PM
  2. iPhone 4 signal propagation issues because of "the band"
    By Gardener in forum Windows Software
    Replies: 5
    Last Post: 01-10-2010, 12:15 PM
  3. What is DNS propagation?
    By Yudhajit in forum Operating Systems
    Replies: 2
    Last Post: 04-06-2009, 11:43 AM
  4. Server Error: 451, Socket Error: 10053, Error Number: 0x800CCC0F
    By Eigenberg in forum Windows XP Support
    Replies: 3
    Last Post: 03-06-2008, 04:13 PM

Tags for this Thread

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
  •  
Page generated in 1,713,867,725.09238 seconds with 16 queries