View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
pete pete is offline
external usenet poster
 
Posts: 88
Default XL97 Private Sub Workbook_Open() Not Working

Tushar Mehta wrote in
om:

In article ,
says...
Tushar Mehta wrote in
om:

Did you at some point execute a 'Application.EnableEvents=False'
statement and not reverse the effect? EnableEvents doesn't affect
the Auto_Open routine.



Yes I did but then took it out.

Seems strange. I am redoing this from scratch and importing the
sheets and routines one by one to try and pin point where this is
occuring.

No, nothing strange. EnableEvents is a persistent setting that XL
remembers for the duration that it is running. Too many use (or
recommend) EnableEvents=False without realizing how long lasting its
effect can be. IMO, the only safe way to use it is within the
equivalent of VB.Net's Try...Catch...Finally structure. In VBA, the
closest would be:

'...
On Error Goto CleanUp
Application.EnableEvents=False
'...
CleanUp:
Application.EnableEvents=True
End Sub


Thanks I will try that. And when I opened a new workbook and copied all
the sheets to it along with the vba code minus the enableevents, it works
fine now.

Thanks again!