Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Old, working macro now stops partway (without error) after Selection.Insert Charles Blaquière Excel Programming 0 October 16th 07 05:56 PM
Macro repeats and then stops Sabba Efie Excel Discussion (Misc queries) 2 August 15th 06 11:03 PM
My Macro stops Bobby Excel Programming 1 January 23rd 06 07:00 PM
overflow error 6.. the macro just stops any idea why? ste mac Excel Programming 4 February 7th 05 04:00 PM
Macro stops before beginning. y Excel Programming 7 April 12th 04 06:06 AM


All times are GMT +1. The time now is 06:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"