Microsoft Office Tutorials and References
In Depth Information
Creating menus for Microsoft Project
Creating menus for Microsoft Project
Microsoft Office Project 2007 provides a very good visual representation of menus
for user interaction with the application. Microsoft Project provides support for
menu customization in order to improve customized visual interaction with users.
VSTO 3.0 offers extensive options to build custom menus and to customize existing
menus to suit users' needs.
Let's see an example of how to create a menu for Microsoft Project by using
VSTO objects.
Open Visual Studio 2008, to create a new Project solution, as done earlier. Write the
following code in the ThisAddIn.cs file.
// The menu details at class level.
private Office.CommandBarButton PacktMenuCmd;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
// Initialize the CommandBarPopup object
Office.CommandBarPopup PacktCmdBarCtrl = null;
// Get the active menubar in the application
Office.CommandBar PacktMenuBar = (Office.
// Get the total controls count in menubar
int ctrlCount = PacktMenuBar.Controls.Count;
// Add the menu with control in the application interface
PacktCmdBarCtrl = (Office.CommandBarPopup)PacktMenuBar.
missing, missing, ctrlCount, true);
// Check for commandbar
if (PacktCmdBarCtrl != null)
// Set the caption property of the commandbar
PacktCmdBarCtrl.Caption = "Packt Book Project";
// Set the Tag property of the commandbar
PacktCmdBarCtrl.Tag = "Tag to identify our Menu";
// Adding the menu command to the commandbar
PacktMenuCmd = (Office.CommandBarButton)PacktCmdBarCtrl.
missing, missing, missing, true);
Search JabSto ::

Custom Search