T
thoff
I got a book on VBA programming in Project("VBA Programming for Microsoft
Office Project") but the custom menu examples don't work in Project 2007.
Doing some research, microsoft doesn't support the old way of doing custom
menus any more. Can someone point me to where the new procedure for doing
custom pull down menus is described? Here is what the book has that doesn't
work. Thanks in advance.
Sub AddMenu()
Dim MyMenu As CommandBarControl
Dim MyButton As CommandBarButton
On Error Resume Next
Set MyMenu = CommandBars("Menu Bar") _
.Controls("My Menu")
If MyMenu Is Nothing Then
Set MyMenu = CommandBars("Menu Bar") _
.Controls.Add(Type:=msoControlPopup, _
ID:=1, Before:=9, Temporary:=True)
MyMenu.Caption = "My Menu"
MyMenu.Enabled = True
Set MyButton = MyMenu.Controls.Add( _
Type:=msoControlButton, ID:=1, Before:=1)
With MyButton
.OnAction = "AddToolbar"
.Enabled = True
.Style = msoButtonCaption
.Caption = "Add Toolbar"
End With
Set MyButton = MyMenu.Controls.Add( _
Type:=msoControlButton, ID:=1, Before:=2)
With MyButton
.OnAction = "DeleteBar"
.Style = msoButtonCaption
.Caption = "Delete Toolbar"
End With
Set MyButton = MyMenu.Controls.Add( _
Type:=msoControlButton, ID:=1, Before:=3)
With MyButton
.OnAction = "DeleteMenu"
.Style = msoButtonCaption
.Caption = "Delete Menu"
End With
End If
End Sub
Office Project") but the custom menu examples don't work in Project 2007.
Doing some research, microsoft doesn't support the old way of doing custom
menus any more. Can someone point me to where the new procedure for doing
custom pull down menus is described? Here is what the book has that doesn't
work. Thanks in advance.
Sub AddMenu()
Dim MyMenu As CommandBarControl
Dim MyButton As CommandBarButton
On Error Resume Next
Set MyMenu = CommandBars("Menu Bar") _
.Controls("My Menu")
If MyMenu Is Nothing Then
Set MyMenu = CommandBars("Menu Bar") _
.Controls.Add(Type:=msoControlPopup, _
ID:=1, Before:=9, Temporary:=True)
MyMenu.Caption = "My Menu"
MyMenu.Enabled = True
Set MyButton = MyMenu.Controls.Add( _
Type:=msoControlButton, ID:=1, Before:=1)
With MyButton
.OnAction = "AddToolbar"
.Enabled = True
.Style = msoButtonCaption
.Caption = "Add Toolbar"
End With
Set MyButton = MyMenu.Controls.Add( _
Type:=msoControlButton, ID:=1, Before:=2)
With MyButton
.OnAction = "DeleteBar"
.Style = msoButtonCaption
.Caption = "Delete Toolbar"
End With
Set MyButton = MyMenu.Controls.Add( _
Type:=msoControlButton, ID:=1, Before:=3)
With MyButton
.OnAction = "DeleteMenu"
.Style = msoButtonCaption
.Caption = "Delete Menu"
End With
End If
End Sub