Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Todd,
I see that you refer to "Worksheet MenuBar" and "Worksheet Menu Bar". Could that be the problem? -- Regards, Jake Marx MS MVP - Excel Todd wrote: I have a macro that only runs the first time you open excel. If I close the workbook and reopen it , it does not run (it is supposed to run everytime). I don't know what to think about that. I went to different computer station and it didn't run at all. Help? Todd The error is marked at: Set MenuItem = Application.CommandBars("Worksheet Menu Bar").Controls(11) Private Sub Workbook_Open() ProtectionMenuBar_Add End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) ProtectionMenuBar_Delete End Sub Sub ProtectionMenuBar_Add() Dim MenuItem As CommandBarControl ProtectionMenuBar_Delete Application.CommandBars("Worksheet MenuBar").Controls.Add Type:= _ msoControlButton, ID:=893, Befo=11 If MenuItem Is Nothing Then Exit Sub Set MenuItem = Nothing End Sub Sub ProtectionMenuBar_Delete() Dim MenuItem As CommandBarControl Set MenuItem = Application.CommandBars("Worksheet Menu Bar").Controls(11) If Not MenuItem Is Nothing Then MenuItem.Delete End If Set MenuItem = Nothing End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs | Setting up and Configuration of Excel | |||
Open Workbook created in Excel 2003 in a computer that runs Excel | Excel Discussion (Misc queries) | |||
One macro runs then it auto runs another macro | Excel Discussion (Misc queries) | |||
Excel runs, but files will not open | Excel Discussion (Misc queries) | |||
Called macro runs twice in excel 2002 | Excel Programming |