Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Error stops App Macro
I have the following code that is run on a right click in the application:
Private Sub App_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) '.....code End Sub But if there is an error in a macro from another excel file then this App_SheetBeforeRightClick does not work and defaults back to the default right click. Is there a way to make it so an error in a macro from another excel file will not affect the App_SheetBeforeRightClick macro. Thank you, Steven |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Error stops App Macro
Your event macro needs Application.EnableEvents to be set to True for it to
be triggered. Another macro may disable events, do some processing, and then re-enable events. If the other macro dies before performing the re-enable, your macro will no longer get triggered. You need to insure that even if the other macro dies, events get re-enabled. -- Gary''s Student - gsnu200824 "Steven" wrote: I have the following code that is run on a right click in the application: Private Sub App_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) '.....code End Sub But if there is an error in a macro from another excel file then this App_SheetBeforeRightClick does not work and defaults back to the default right click. Is there a way to make it so an error in a macro from another excel file will not affect the App_SheetBeforeRightClick macro. Thank you, Steven |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Error stops App Macro
For the right click to stop working, there is probably code in one of the
macros which turns off events Application.EnableEvents = False The other macro has to be fixed so when there is an error events get turned on again. "Steven" wrote: I have the following code that is run on a right click in the application: Private Sub App_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean) '.....code End Sub But if there is an error in a macro from another excel file then this App_SheetBeforeRightClick does not work and defaults back to the default right click. Is there a way to make it so an error in a macro from another excel file will not affect the App_SheetBeforeRightClick macro. Thank you, Steven |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Old, working macro now stops partway (without error) after Selection.Insert | Excel Programming | |||
Macro repeats and then stops | Excel Discussion (Misc queries) | |||
My Macro stops | Excel Programming | |||
overflow error 6.. the macro just stops any idea why? | Excel Programming | |||
Macro stops before beginning. | Excel Programming |