Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jan Karel and Bob,
Interesting points. Which choice of method is a dilemma I've struggled with. Ideally I prefer to disable/enable events, but no matter how good my error handling there is always the possibility of some unknown interaction with other stuff in the user's app. Eg a calculation caused by writing to cells can fire user's udf's, even in an unrelated workbook. If these are not correctly handled they can cause all code to just stop (not same as "end"), without realising variables in my code (particularly problematic in xl97). Of course the solution is to disable calculation but that's just another thing that might not get reset correctly. In any case would prefer not to disable calculation merely to cater for a small possibility of such a problem. Regards, Peter T "Jan Karel Pieterse" wrote in message ... Hi Bob, I was also thinking about the variable approach which I noticed in your other response. That approach can fail just as easily, but of course events only get disabled if they use that variable, other events continue ok. My thoughts went along the lines, is it better to be wrong some of the time (when the variable gets knocked out), or to be wrong all of the time (if EnableEvents get knocked out). Couldn't come to a conclusion, as the famous phrase '... it depends ...' kicks in, so we have to adopt a solution to suit (as ever ;-)). Agreed. Another advantage I see in using a variable is when one clicks End on an error message, the variable gets reset to false automatically and the event works once more. But as stated in this thread more than once, the only true solution is to use proper error handling in the subs concerned. Whether one uses a (static or global) variable to prevent local (or even projectwide) looping or EnableEvents to prevent global looping depends on the situation. Of course to be completely foolproof, I guess it is the latter. One never knows what other code is "active" besides ones own application. So: Implement Error handling!!! Regards, Jan Karel Pieterse Excel MVP www.jkp-ads.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Worksheet change event not firing | Excel Programming | |||
worksheet_SelectionChange Event | Excel Programming | |||
Workbook.Open Event Procedure not firing | Excel Programming | |||
OnTime event not firing in Workbook_Open event procedure | Excel Programming | |||
Worksheet_SelectionChange Event | Excel Programming |