Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
Hi all
After a bit of testing I am satisfied that the macro Private Sub Workbook_Open() that resides behind "ThisWorkbook" is not running at all when the workbook is opened. Any ideas how I should try to fix this? I tried running Rob Bovey's code cleaner, and the project compiles ok without any errors. -- Return email address is not as DEEP as it appears |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
Jack, what version of excel are you using? If 2000 or above check tools
macro security and see if it is set to high or very high -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Hi all After a bit of testing I am satisfied that the macro Private Sub Workbook_Open() that resides behind "ThisWorkbook" is not running at all when the workbook is opened. Any ideas how I should try to fix this? I tried running Rob Bovey's code cleaner, and the project compiles ok without any errors. -- Return email address is not as DEEP as it appears |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
Jack , it could also could be a sticking shift key, that will keep the
startup macro from running -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul B" wrote in message ... Jack, what version of excel are you using? If 2000 or above check tools macro security and see if it is set to high or very high -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Hi all After a bit of testing I am satisfied that the macro Private Sub Workbook_Open() that resides behind "ThisWorkbook" is not running at all when the workbook is opened. Any ideas how I should try to fix this? I tried running Rob Bovey's code cleaner, and the project compiles ok without any errors. -- Return email address is not as DEEP as it appears |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
Thanks.
I don't think that it is a sticky shift key, because I emailed the workbook from work to home and it displays the same problem. At home I am using Office XP Pro 2002 SP2 I think it is the same version at the office. The other macros work OK, so in principle the security settings permit macro execution (I get a warning message that it contains macros when I load the file, and I choose to "enable macros"). Also, I tried putting the code into an Auto_Open() macro in a general module and that seemed to run OK. It just won't work from Workbook_Open() in the ThisWorkbook module. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack , it could also could be a sticking shift key, that will keep the startup macro from running -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul B" wrote in message ... Jack, what version of excel are you using? If 2000 or above check tools macro security and see if it is set to high or very high -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Hi all After a bit of testing I am satisfied that the macro Private Sub Workbook_Open() that resides behind "ThisWorkbook" is not running at all when the workbook is opened. Any ideas how I should try to fix this? I tried running Rob Bovey's code cleaner, and the project compiles ok without any errors. -- Return email address is not as DEEP as it appears |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
Jack, Don't know what you code looks like , may need to post the code and
see if somebody can see anything in it that could be causing this to happen, maybe on error exit sub? What happens if you try a simple macro to test it, like this Private Sub Workbook_Open() MsgBox "It Works!" End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Thanks. I don't think that it is a sticky shift key, because I emailed the workbook from work to home and it displays the same problem. At home I am using Office XP Pro 2002 SP2 I think it is the same version at the office. The other macros work OK, so in principle the security settings permit macro execution (I get a warning message that it contains macros when I load the file, and I choose to "enable macros"). Also, I tried putting the code into an Auto_Open() macro in a general module and that seemed to run OK. It just won't work from Workbook_Open() in the ThisWorkbook module. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack , it could also could be a sticking shift key, that will keep the startup macro from running -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul B" wrote in message ... Jack, what version of excel are you using? If 2000 or above check tools macro security and see if it is set to high or very high -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Hi all After a bit of testing I am satisfied that the macro Private Sub Workbook_Open() that resides behind "ThisWorkbook" is not running at all when the workbook is opened. Any ideas how I should try to fix this? I tried running Rob Bovey's code cleaner, and the project compiles ok without any errors. -- Return email address is not as DEEP as it appears |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
Thanks. Already thought of that, so I deleted all the code from the
Workbook_Open() except for a msgbox instruction - no dice. Put that one line into Auto_Open() and it worked. I wonder if it may be symptomatic of some workbook corruption and if it is whether there is a quick way of filtering out corruptions of this nature. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack, Don't know what you code looks like , may need to post the code and see if somebody can see anything in it that could be causing this to happen, maybe on error exit sub? What happens if you try a simple macro to test it, like this Private Sub Workbook_Open() MsgBox "It Works!" End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Thanks. I don't think that it is a sticky shift key, because I emailed the workbook from work to home and it displays the same problem. At home I am using Office XP Pro 2002 SP2 I think it is the same version at the office. The other macros work OK, so in principle the security settings permit macro execution (I get a warning message that it contains macros when I load the file, and I choose to "enable macros"). Also, I tried putting the code into an Auto_Open() macro in a general module and that seemed to run OK. It just won't work from Workbook_Open() in the ThisWorkbook module. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack , it could also could be a sticking shift key, that will keep the startup macro from running -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul B" wrote in message ... Jack, what version of excel are you using? If 2000 or above check tools macro security and see if it is set to high or very high -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Hi all After a bit of testing I am satisfied that the macro Private Sub Workbook_Open() that resides behind "ThisWorkbook" is not running at all when the workbook is opened. Any ideas how I should try to fix this? I tried running Rob Bovey's code cleaner, and the project compiles ok without any errors. -- Return email address is not as DEEP as it appears |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
Copy-paste the code into a new blank workbook and see if it runs there.
Sure you don't have any misspellings in the macro name ? Since you refuse to post the code then you must check that yourself. HTH. Best wishes Harald "Jack Sheet" skrev i melding ... Thanks. Already thought of that, so I deleted all the code from the Workbook_Open() except for a msgbox instruction - no dice. Put that one line into Auto_Open() and it worked. I wonder if it may be symptomatic of some workbook corruption and if it is whether there is a quick way of filtering out corruptions of this nature. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack, Don't know what you code looks like , may need to post the code and see if somebody can see anything in it that could be causing this to happen, maybe on error exit sub? What happens if you try a simple macro to test it, like this Private Sub Workbook_Open() MsgBox "It Works!" End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Thanks. I don't think that it is a sticky shift key, because I emailed the workbook from work to home and it displays the same problem. At home I am using Office XP Pro 2002 SP2 I think it is the same version at the office. The other macros work OK, so in principle the security settings permit macro execution (I get a warning message that it contains macros when I load the file, and I choose to "enable macros"). Also, I tried putting the code into an Auto_Open() macro in a general module and that seemed to run OK. It just won't work from Workbook_Open() in the ThisWorkbook module. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack , it could also could be a sticking shift key, that will keep the startup macro from running -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul B" wrote in message ... Jack, what version of excel are you using? If 2000 or above check tools macro security and see if it is set to high or very high -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Hi all After a bit of testing I am satisfied that the macro Private Sub Workbook_Open() that resides behind "ThisWorkbook" is not running at all when the workbook is opened. Any ideas how I should try to fix this? I tried running Rob Bovey's code cleaner, and the project compiles ok without any errors. -- Return email address is not as DEEP as it appears |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
Hi Harald, thanks for the help
I did post the original code, under the header "UserInterfaceOnly on startup" in this newsgroup. It did not elicit any responses. I have since tried Paul's code precisely as below: Private Sub Workbook_Open() MsgBox "It Works!" End Sub It would not run in the offending workbook. I have tried your suggestion and copied the above into a new workbook, and it does run in the new workbook. I have also tried (in a general module) Private Sub Auto_Open() MsgBox "It Works!" End Sub And that works OK. I have just one other macro in the ThisWorkbook code of the offending workbook, and this seems to run OK when the workbook closes: Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim Msg As String Dim Ans As Long If Not Me.Saved Then Msg = "Leaving so soon? Oh, well, perhaps better save first?" Ans = MsgBox(Msg, vbQuestion + vbYesNoCancel) Select Case Ans Case vbYes ' Call RefreshAllPivots Me.Save Case vbNo Me.Saved = True Case vbCancel Cancel = True Exit Sub End Select 'Case Ans End If 'Not Me.Saved On Error Resume Next ' in case toolbar is not there Application.CommandBars("Project Manager").Delete On Error GoTo 0 End Sub 'Workbook_BeforeClose(Cancel As Boolean) -- Return email address is not as DEEP as it appears "Harald Staff" wrote in message ... Copy-paste the code into a new blank workbook and see if it runs there. Sure you don't have any misspellings in the macro name ? Since you refuse to post the code then you must check that yourself. HTH. Best wishes Harald "Jack Sheet" skrev i melding ... Thanks. Already thought of that, so I deleted all the code from the Workbook_Open() except for a msgbox instruction - no dice. Put that one line into Auto_Open() and it worked. I wonder if it may be symptomatic of some workbook corruption and if it is whether there is a quick way of filtering out corruptions of this nature. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack, Don't know what you code looks like , may need to post the code and see if somebody can see anything in it that could be causing this to happen, maybe on error exit sub? What happens if you try a simple macro to test it, like this Private Sub Workbook_Open() MsgBox "It Works!" End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Thanks. I don't think that it is a sticky shift key, because I emailed the workbook from work to home and it displays the same problem. At home I am using Office XP Pro 2002 SP2 I think it is the same version at the office. The other macros work OK, so in principle the security settings permit macro execution (I get a warning message that it contains macros when I load the file, and I choose to "enable macros"). Also, I tried putting the code into an Auto_Open() macro in a general module and that seemed to run OK. It just won't work from Workbook_Open() in the ThisWorkbook module. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack , it could also could be a sticking shift key, that will keep the startup macro from running -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul B" wrote in message ... Jack, what version of excel are you using? If 2000 or above check tools macro security and see if it is set to high or very high -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Hi all After a bit of testing I am satisfied that the macro Private Sub Workbook_Open() that resides behind "ThisWorkbook" is not running at all when the workbook is opened. Any ideas how I should try to fix this? I tried running Rob Bovey's code cleaner, and the project compiles ok without any errors. -- Return email address is not as DEEP as it appears |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
Hi Jack
I've also had the same problem intermittently. We are by no means alone as a quick Google will reveal. But I have not seen cause/solution posted. "Shift" has been mentioned but don't rule it out completely as a possibilty, it can be the mysterious route of several unexplained problems and not at all obvious. I've not had a problem recently but I can't be totally confident of Workbook_open. To the extent I now have a backup check in Auto_Open. My open routine needs, amongst other things, to set a global variable. All "should" be have been triggered from wb_open but I also have: Auto_Open() If myGlobalVar = 0 then Do_Open_Routine 'Do_Open_Routine is in a normal module 'that should have been done already May seem like overkill but it's not much extra, just to be sure! Regards, Peter "Jack Sheet" wrote in message ... Hi Harald, thanks for the help I did post the original code, under the header "UserInterfaceOnly on startup" in this newsgroup. It did not elicit any responses. I have since tried Paul's code precisely as below: Private Sub Workbook_Open() MsgBox "It Works!" End Sub It would not run in the offending workbook. I have tried your suggestion and copied the above into a new workbook, and it does run in the new workbook. I have also tried (in a general module) Private Sub Auto_Open() MsgBox "It Works!" End Sub And that works OK. I have just one other macro in the ThisWorkbook code of the offending workbook, and this seems to run OK when the workbook closes: Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim Msg As String Dim Ans As Long If Not Me.Saved Then Msg = "Leaving so soon? Oh, well, perhaps better save first?" Ans = MsgBox(Msg, vbQuestion + vbYesNoCancel) Select Case Ans Case vbYes ' Call RefreshAllPivots Me.Save Case vbNo Me.Saved = True Case vbCancel Cancel = True Exit Sub End Select 'Case Ans End If 'Not Me.Saved On Error Resume Next ' in case toolbar is not there Application.CommandBars("Project Manager").Delete On Error GoTo 0 End Sub 'Workbook_BeforeClose(Cancel As Boolean) -- Return email address is not as DEEP as it appears "Harald Staff" wrote in message ... Copy-paste the code into a new blank workbook and see if it runs there. Sure you don't have any misspellings in the macro name ? Since you refuse to post the code then you must check that yourself. HTH. Best wishes Harald "Jack Sheet" skrev i melding ... Thanks. Already thought of that, so I deleted all the code from the Workbook_Open() except for a msgbox instruction - no dice. Put that one line into Auto_Open() and it worked. I wonder if it may be symptomatic of some workbook corruption and if it is whether there is a quick way of filtering out corruptions of this nature. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack, Don't know what you code looks like , may need to post the code and see if somebody can see anything in it that could be causing this to happen, maybe on error exit sub? What happens if you try a simple macro to test it, like this Private Sub Workbook_Open() MsgBox "It Works!" End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Thanks. I don't think that it is a sticky shift key, because I emailed the workbook from work to home and it displays the same problem. At home I am using Office XP Pro 2002 SP2 I think it is the same version at the office. The other macros work OK, so in principle the security settings permit macro execution (I get a warning message that it contains macros when I load the file, and I choose to "enable macros"). Also, I tried putting the code into an Auto_Open() macro in a general module and that seemed to run OK. It just won't work from Workbook_Open() in the ThisWorkbook module. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack , it could also could be a sticking shift key, that will keep the startup macro from running -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul B" wrote in message ... Jack, what version of excel are you using? If 2000 or above check tools macro security and see if it is set to high or very high -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Hi all After a bit of testing I am satisfied that the macro Private Sub Workbook_Open() that resides behind "ThisWorkbook" is not running at all when the workbook is opened. Any ideas how I should try to fix this? I tried running Rob Bovey's code cleaner, and the project compiles ok without any errors. -- Return email address is not as DEEP as it appears |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
A couple of possible solutions I posted recently both involved setting
the workbook to manual calculation. Full details can be found at thread. (Search on "Workbook Open event does not fire".) Peter T wrote: Hi Jack I've also had the same problem intermittently. We are by no means alone as a quick Google will reveal. But I have not seen cause/solution posted. "Shift" has been mentioned but don't rule it out completely as a possibilty, it can be the mysterious route of several unexplained problems and not at all obvious. I've not had a problem recently but I can't be totally confident of Workbook_open. To the extent I now have a backup check in Auto_Open. My open routine needs, amongst other things, to set a global variable. All "should" be have been triggered from wb_open but I also have: Auto_Open() If myGlobalVar = 0 then Do_Open_Routine 'Do_Open_Routine is in a normal module 'that should have been done already May seem like overkill but it's not much extra, just to be sure! Regards, Peter |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
Ok, sorry, didn't see that one. Does ANY workbook event run at the time? Try
this code for Auto_open: Sub Auto_open() MsgBox Application.EnableEvents End Sub if it returns False then something has disabled workbook and worksheet events. Auto_Open is not part of the events, so that runs fine. You do have a reply there now btw, and it's also a "it works fine here". Maybe you have a corrupted file. Which can be just everything, there is no reliable way to spot, isolate and remove a corruption. Copy-paste everything piece by piece into a brand new workbook is the way to go if so. (Userforms can be exported-imported, but test carefully afterwards.) Best wishes Harald "Jack Sheet" skrev i melding ... Hi Harald, thanks for the help I did post the original code, under the header "UserInterfaceOnly on startup" in this newsgroup. It did not elicit any responses. I have since tried Paul's code precisely as below: Private Sub Workbook_Open() MsgBox "It Works!" End Sub It would not run in the offending workbook. I have tried your suggestion and copied the above into a new workbook, and it does run in the new workbook. I have also tried (in a general module) Private Sub Auto_Open() MsgBox "It Works!" End Sub And that works OK. I have just one other macro in the ThisWorkbook code of the offending workbook, and this seems to run OK when the workbook closes: Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim Msg As String Dim Ans As Long If Not Me.Saved Then Msg = "Leaving so soon? Oh, well, perhaps better save first?" Ans = MsgBox(Msg, vbQuestion + vbYesNoCancel) Select Case Ans Case vbYes ' Call RefreshAllPivots Me.Save Case vbNo Me.Saved = True Case vbCancel Cancel = True Exit Sub End Select 'Case Ans End If 'Not Me.Saved On Error Resume Next ' in case toolbar is not there Application.CommandBars("Project Manager").Delete On Error GoTo 0 End Sub 'Workbook_BeforeClose(Cancel As Boolean) -- Return email address is not as DEEP as it appears "Harald Staff" wrote in message ... Copy-paste the code into a new blank workbook and see if it runs there. Sure you don't have any misspellings in the macro name ? Since you refuse to post the code then you must check that yourself. HTH. Best wishes Harald "Jack Sheet" skrev i melding ... Thanks. Already thought of that, so I deleted all the code from the Workbook_Open() except for a msgbox instruction - no dice. Put that one line into Auto_Open() and it worked. I wonder if it may be symptomatic of some workbook corruption and if it is whether there is a quick way of filtering out corruptions of this nature. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack, Don't know what you code looks like , may need to post the code and see if somebody can see anything in it that could be causing this to happen, maybe on error exit sub? What happens if you try a simple macro to test it, like this Private Sub Workbook_Open() MsgBox "It Works!" End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Thanks. I don't think that it is a sticky shift key, because I emailed the workbook from work to home and it displays the same problem. At home I am using Office XP Pro 2002 SP2 I think it is the same version at the office. The other macros work OK, so in principle the security settings permit macro execution (I get a warning message that it contains macros when I load the file, and I choose to "enable macros"). Also, I tried putting the code into an Auto_Open() macro in a general module and that seemed to run OK. It just won't work from Workbook_Open() in the ThisWorkbook module. -- Return email address is not as DEEP as it appears "Paul B" wrote in message ... Jack , it could also could be a sticking shift key, that will keep the startup macro from running -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Paul B" wrote in message ... Jack, what version of excel are you using? If 2000 or above check tools macro security and see if it is set to high or very high -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Jack Sheet" wrote in message ... Hi all After a bit of testing I am satisfied that the macro Private Sub Workbook_Open() that resides behind "ThisWorkbook" is not running at all when the workbook is opened. Any ideas how I should try to fix this? I tried running Rob Bovey's code cleaner, and the project compiles ok without any errors. -- Return email address is not as DEEP as it appears |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open() will not run
It returns True.
No sweat I shall reconstruct. It would be nice if there were a one-click utility out there to do that. "Harald Staff" wrote in message ... Ok, sorry, didn't see that one. Does ANY workbook event run at the time? Try this code for Auto_open: Sub Auto_open() MsgBox Application.EnableEvents End Sub if it returns False then something has disabled workbook and worksheet events. Auto_Open is not part of the events, so that runs fine. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Workbook_Open () | Excel Discussion (Misc queries) | |||
Workbook_Open | Excel Programming | |||
workbook_open | Excel Programming | |||
Workbook_Open | Excel Programming | |||
Help with Workbook_Open | Excel Programming |