Outlook doesn't know CommandBars

  • Thread starter Thread starter Randy Harris
  • Start date Start date
R

Randy Harris

I'm trying to work examples right out of the Help, but can't.

The line:

Set cbrMenu = gobjAppInstance.CommandBars(CBR_NAME)

Gets error #438, Object doesn't support this property or method.

also:

For Each cbar In CommandBars

errors, CommandBars variable is not defined.

It acts like there is a library reference missing or something. I'm tearing
my hair out and sure would appreciate some help.
 
We would have to post the entire code segment you are working with, but
looking at what you posted I could guess that "gobjAppInstance" does not
contain a Explorer or Inspector object. Only the Explorer and Inspect
objects expose the CommandBars property.

/neo

PS - The segment of code you are looking at might be designed for Word or
Excel. Each of these application expose the CommandBars property thru their
"Application" object.
 
neo said:
We would have to post the entire code segment you are working with, but
looking at what you posted I could guess that "gobjAppInstance" does not
contain a Explorer or Inspector object. Only the Explorer and Inspect
objects expose the CommandBars property.

/neo

PS - The segment of code you are looking at might be designed for Word or
Excel. Each of these application expose the CommandBars property thru their
"Application" object.

Thanks neo. I've gotten a little bit further by using:

Set cbrMenu = gobjAppInstance.ActiveExplorer.CommandBars(CBR_NAME)

It now adds the button to the CommandBar. The next thing I need to figure
out is how to reference CommandBars on Item windows, rather than on the
Application window. I have been reading up on it. I know that I need to
use Inspector rather than Explorer, but I can't figure out how to do it.
 
Randy Harris said:
Thanks neo. I've gotten a little bit further by using:

Set cbrMenu = gobjAppInstance.ActiveExplorer.CommandBars(CBR_NAME)

It now adds the button to the CommandBar. The next thing I need to figure
out is how to reference CommandBars on Item windows, rather than on the
Application window. I have been reading up on it. I know that I need to
use Inspector rather than Explorer, but I can't figure out how to do it.

Is it even possible to reference CommanBars on Item windows that aren't
open?
 
It is possible to create an item that doesn't have an Inspector window. The
methods that might help you are ActiveInspector which is exposed by the
Application object or the Add method that is exposed by the Inspectors
collection object.

Not sure if you noticed yet, but using Word as the email editor could put
another twist into your learning.
 
neo said:
It is possible to create an item that doesn't have an Inspector window. The
methods that might help you are ActiveInspector which is exposed by the
Application object or the Add method that is exposed by the Inspectors
collection object.

I spent the entire weekend trying to make this work. So far no dice. I need
to add a button to the mail message window. The code is in a COM add-in
which gets loaded when Outlook starts. I can add the button to the
Application window fine, but that does me no good. Near as I can tell, when
Outlook loads, there is no ActiveInspector and no CurrentItem. I dug
through several books on Outlook and Office programming, scoured the
documentation and googled endlessly. I can't figure out how to do it.
 
Back
Top