Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
XL97 Private Sub Workbook_Open() Not Working
Question, why did Private Sub Workbook_Open()
not work? I have used it many times before and it worked fine. But on this project it would not work, but if I put in an Sub Auto_Open () routine it works fine. ---- this does not work in the ThisWorkbook Private Sub Workbook_Open() MsgBox "Application Opened ThisWorkbook" ' put in to debug Display_UnitInfo End Sub ----- But this does work on Module1 Sub Auto_Open() Display_UnitInfo MsgBox "Application Opened ThisWorkbook" ' put in to debug End Sub I can live with it, but curious why as to the Workbook_Open() stopped working in this project. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
XL97 Private Sub Workbook_Open() Not Working
Is there any rationale behind the fact that the code statements are
reversed? -- HTH RP (remove nothere from the email address if mailing direct) "Pete" wrote in message ... Question, why did Private Sub Workbook_Open() not work? I have used it many times before and it worked fine. But on this project it would not work, but if I put in an Sub Auto_Open () routine it works fine. ---- this does not work in the ThisWorkbook Private Sub Workbook_Open() MsgBox "Application Opened ThisWorkbook" ' put in to debug Display_UnitInfo End Sub ----- But this does work on Module1 Sub Auto_Open() Display_UnitInfo MsgBox "Application Opened ThisWorkbook" ' put in to debug End Sub I can live with it, but curious why as to the Workbook_Open() stopped working in this project. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
XL97 Private Sub Workbook_Open() Not Working
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. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
XL97 Private Sub Workbook_Open() Not Working
"Bob Phillips" wrote in
: Is there any rationale behind the fact that the code statements are reversed? Nope, just inserted them to see for myself if the code was working. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
XL97 Private Sub Workbook_Open() Not Working
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 -- Regards, Tushar Mehta www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Private Sub Workbook_Open() doesn't run | Excel Discussion (Misc queries) | |||
Function in xl2003 not working in xl97 | Excel Discussion (Misc queries) | |||
Cannot get Auto_Open or Private Sub Workbook_Open() to run at star | Excel Programming | |||
Private Sub Workbook_Open() not running on open | Excel Programming | |||
Macro created in XL2000 not working in XL97 | Excel Programming |