createMenu macro

A

Andreas

The following macro (part of it) isn't working with Project 2003 although it
is working with Project 2000 and Excel 2003! What is the problem? Are there
changes made (Project 2000 -> 2003)?


Sub CreateMenu()

Dim HelpMenu As CommandBarControl
Dim NewMenu As CommandBarPopup

Call DeleteMenu

Set HelpMenu = CommandBars(1).FindControl(ID:=30010)

If HelpMenu Is Nothing Then
Set NewMenu = CommandBars(1).Controls _
.Add(Type:=msoControlPopup, temporary:=True)
Else
Set NewMenu = CommandBars(1).Controls _
.Add(Type:=msoControlPopup, Before:=HelpMenu.Index, _
temporary:=True)
End If


NewMenu.Caption = "Output"

Set MenuItem = NewMenu.Controls.Add(Type:=msoControlButton)
With MenuItem
.Caption = "Adjust"
.OnAction = "adjust"
End With

Set MenuItem = NewMenu.Controls.Add(Type:=msoControlButton)
With MenuItem
.Caption = "Rework"
.OnAction = "rework"
End With

End Sub


Thanks a lot!
Andi
 
J

Jan De Messemaeker

Hi,

A relevant change is probably the introduction of the task pane as
commandbars(1). AFAIK this does not accept controls.add

Looks like you better use application.commandbars("Menu Bar")

HTH
 
Top