Article ID: 292182 - Last Review: March 1, 2004 - Revision: 1.3

OL2002: CommandBars Not Available from Application Object

This article was previously published under Q292182
Expand all | Collapse all

SYMPTOMS

You use programming code to automate the Microsoft Office CommandBars object model, but the code generates an error when used with Outlook.

CAUSE

Unlike other Office programs, the CommandBars object is not available as a property of the Outlook.Application object. Therefore, errors will occur if you use code that is designed for other Office programs.

RESOLUTION

Outlook implements CommandBars in both folder windows and form windows, so the CommandBars object is accessed through the Explorer and Inspector objects, respectively. Modify your code to include one of these objects, as appropriate.

MORE INFORMATION

Most CommandBar code examples that are available on the http://msdn.microsoft.com Web site and in other Microsoft Office documentation were designed for the other Office programs.

The following Visual Basic for Applications code segment illustrates how to reference the CommandBars object in Outlook:

Set myExplorer = Application.ActiveExplorer
Set myBar = myExplorer.CommandBars.Add(Name:="ChangingButton", _
   Position:=msoBarTop, Temporary:=True)
				

REFERENCES

For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:
287530  (http://support.microsoft.com/kb/287530/EN-US/ ) OL2002: Questions About Custom Forms and Outlook Solutions

APPLIES TO
  • Microsoft Outlook 2002 Standard Edition
Keywords: 
kbprb KB292182
 

Article Translations

 

Related Support Centers