R
Renato
You fix one thing another pops up! I've added a custom menu to a workbook
template. That work very well using event handlers Workbook_activate &
Workbook_deactivate in ThisWorkbook.
I can add menu items thru Autpen. Workbook_Deactivate deletes the item
when I jump over to the next workbook. The proplem that I'm having is that
when these Templates are saved in different names and open at the same time,
all the menu items disapper. First they disapper on the inactive workbook,
then when you click over to the inactive the other menu items disapper.
Below is the code:
Sub Autpen()
Dim Item As CommandBarControl
Set Item = CommandBars(1).Controls("Custom") _
.Controls.Add
Item.Caption = "&AllenPark"
Item.OnAction = "AllenPark"
Item.BeginGroup = True
End Sub
Sub Workbook_Deactivate()
On Error Resume Next
CommandBars(1).Controls("Custom").Controls("&AllenPark").Delete
End Sub
Sub AllenPark()
MsgBox "This is a do-nothing macro.", vbInformation, "AllenPark"
End Sub
Does anyone know a way to get around this? A way to get the menu items to
appear everytime the workbook becomes active? I guess the diasppearing works
ok.
template. That work very well using event handlers Workbook_activate &
Workbook_deactivate in ThisWorkbook.
I can add menu items thru Autpen. Workbook_Deactivate deletes the item
when I jump over to the next workbook. The proplem that I'm having is that
when these Templates are saved in different names and open at the same time,
all the menu items disapper. First they disapper on the inactive workbook,
then when you click over to the inactive the other menu items disapper.
Below is the code:
Sub Autpen()
Dim Item As CommandBarControl
Set Item = CommandBars(1).Controls("Custom") _
.Controls.Add
Item.Caption = "&AllenPark"
Item.OnAction = "AllenPark"
Item.BeginGroup = True
End Sub
Sub Workbook_Deactivate()
On Error Resume Next
CommandBars(1).Controls("Custom").Controls("&AllenPark").Delete
End Sub
Sub AllenPark()
MsgBox "This is a do-nothing macro.", vbInformation, "AllenPark"
End Sub
Does anyone know a way to get around this? A way to get the menu items to
appear everytime the workbook becomes active? I guess the diasppearing works
ok.