Adding a menu item?

E

Ed Staffin

Could someone share with me or at least point me to where
I could find out how to add a menu item to an existing
menu in project 2003 or (even better) how to add a new top
level menu item with my own menu items underneath?

I'd like to do this in project vba.
Thanks ... Ed
 
J

JackD

The easiest way to understand how to do this is turn on the macro recorder
and create the tool bar (from view menu select toolbars, click new then drag
commands onto it) Here is what I got when I created a toolbar named foo that
has file open and file close commands on it:

(actually I added the line continuation characters and the comments here so
it would stay readable, but the code is the same)

Sub addFooBar()
'add a new command bar
CommandBars.Add(Name:="Foo").Visible = True
'add a file open button
CommandBars("Foo").Controls.Add Type:=msoControlButton, _
ID:=23, _
Before:=1, _
Parameter:="FileOpen"
'add a file close button
CommandBars("Foo").Controls.Add Type:=msoControlButton, _
ID:=106, _
Before:=2, _
Parameter:="FileClose"
End Sub

From here you can figure out how to add your own buttons and commands. I
think that the recording a macro approach is probably the best as I have not
found any documentation for what the controlbutton ID's are. The only way to
find out is trial and error.

-Jack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top