VBA Error Handling When Opening Another Macro

  • RonMexico

    Hall of Fame

    Points: 3251

    I have a process in which a macro loops through a list of other macros to run. I'm trying to add error handling in the parent macro so that if one of the other macros being called errors then it won't pop up with an alert and it will also close out and move on to the next macro in the list. Here is what I'm experimenting with but I'm finding it does not control the list of macros being opened.

    Sub Test()
    Application.DisplayAlerts = False

    On Error GoTo ErrorHandling

    Workbooks.Open Filename:= "C:\temp\SubMacro.xlsm"

    Done:
    Exit Sub
    ErrorHandling:
    MsgBox "The following error occurred: " & Err.Description
    End Sub

    Does anyone know if what I'm trying to achieve is possible?

  • Erland Sommarskog

    SSC-Insane

    Points: 23770

    Looks like you are in the entirely wrong forum. This is a forum for SQL Server questions. You need to find a place where they discuss Excel.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]

  • RonMexico

    Hall of Fame

    Points: 3251

    That's why I posted it under the Programming --> General category. The Programming category has subcategories such as PowerShell and testing methodologies so I did't think it was too far fetched and figured I would give it a shot.

  • pietlinden

    SSC Guru

    Points: 62395

    Try utteraccess.com

    In spite of the name, they discuss all MS Office stuff there.

  • RonMexico

    Hall of Fame

    Points: 3251

    Thanks pietlinden!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply