View Full Version : Solved: Converting Toolbars/Menus from 2003 to 2007

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

07-17-2009, 05:08 PM
2007 has a different UI paradigm,. I don't know about Project, but with Excel you see the old CBs on the Addins tab. If you want a proper 2007 ribbon/group, you have to create it in XML.

07-21-2009, 10:11 AM
I'm not sure about that. MSProject 2007 doesn't have the xlm ribbons/chunks that you see in the rest of office, and my toolbars/menus show up normally, they just don't do anything when clicked. It's like the OnAction doesn't work for 2007. This is what I was hoping to figure out. Do you have any example code for a toolbar / ribbon creation that I could try out in 07? Perhaps it is xml and I'm just not see in properly. Thanks!!

07-22-2009, 06:31 AM
You were right. I'll look at the section for ribbon help. Thanks for pointing me in the right direction!!!