Macro Error stops App Macro

S

Steven

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
 
G

Gary''s Student

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.
 
J

Joel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top