Welcome to MSDN Blogs Sign in | Join | Help

Handling office CommandBar controls

While working on office applications, there are scenarios when we need to control the functionality of Command Bar controls. With Command Bar I means, menu bars, toolbars, shortcut menus, context menus and submenus on menus. Best way to get the control’s object is to use the FindControl function and get the control using its unique command ID. Command ID list can be obtained from http://support.microsoft.com/kb/213552

 

Outlook.Explorers actExplorer = Application.ActiveExplorer();

CommandBars cmdBars = actExplorer.CommandBars;

 

foreach(CommandBar bar in cmdBars)

{

      if(bar.Name == "Menu Bar")

      {

            //Copy

            control = bar.FindControl(MsoControlType.msoControlButton,2499,null,false,recursive);

            if(control!=null)

            {

            //act on the control, like enable/disable/fire the click event of the control

            }

      }

}

Published Friday, November 02, 2007 6:16 AM by manish_mgsi

Comments

# MSDN Blog Postings » Handling office CommandBar controls

Friday, November 02, 2007 3:11 AM by MSDN Blog Postings » Handling office CommandBar controls
Anonymous comments are disabled
 
Page view tracker