sherryjoo
07-17-2009, 08:19 AM
Hi - I'm upgrading my users from 2003 to 2007, but I can't seem to make the custom toolbars and menus convert to 2007. I'm creating them on the fly on open. Everything works great except for the OnAction. Does anyone have any experience with this? Thanks!!
Sub MenuXXX()
Dim myMenuBar As CommandBar
Dim newMenu As CommandBarControl
Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, temporary:=True)
newMenu.Caption = "XXX"
With newMenu
Set ctrl1 = newMenu.CommandBar.Controls.Add(msoControlButton, , , , False)
With ctrl1
.Caption = "MIPS Forecast"
.TooltipText = "MIPS Forecast"
.Style = msoButtonIconAndCaption
.OnAction = ("RunLocalMips_Forecast")
.FaceId = 645
.BeginGroup = True
End With
Set ctrl2 = newMenu.CommandBar.Controls.Add(msoControlButton, , , , False)
With ctrl2
.Caption = "MIPS Workload"
.TooltipText = "MIPS Workload"
.Style = msoButtonIconAndCaption
.OnAction = ("RunLocalMips_Workload")
.FaceId = 2099
End With
Set ctrl3 = newMenu.CommandBar.Controls.Add(msoControlButton, , , , False)
With ctrl3
.Caption = "MIPS Milestone"
.TooltipText = "MIPS Milestone"
.Style = msoButtonIconAndCaption
.OnAction = ("RunLocalMips_Milestone")
.FaceId = 298
End With
End Sub
Sub MenuXXX()
Dim myMenuBar As CommandBar
Dim newMenu As CommandBarControl
Set myMenuBar = CommandBars.ActiveMenuBar
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, temporary:=True)
newMenu.Caption = "XXX"
With newMenu
Set ctrl1 = newMenu.CommandBar.Controls.Add(msoControlButton, , , , False)
With ctrl1
.Caption = "MIPS Forecast"
.TooltipText = "MIPS Forecast"
.Style = msoButtonIconAndCaption
.OnAction = ("RunLocalMips_Forecast")
.FaceId = 645
.BeginGroup = True
End With
Set ctrl2 = newMenu.CommandBar.Controls.Add(msoControlButton, , , , False)
With ctrl2
.Caption = "MIPS Workload"
.TooltipText = "MIPS Workload"
.Style = msoButtonIconAndCaption
.OnAction = ("RunLocalMips_Workload")
.FaceId = 2099
End With
Set ctrl3 = newMenu.CommandBar.Controls.Add(msoControlButton, , , , False)
With ctrl3
.Caption = "MIPS Milestone"
.TooltipText = "MIPS Milestone"
.Style = msoButtonIconAndCaption
.OnAction = ("RunLocalMips_Milestone")
.FaceId = 298
End With
End Sub