Previous Thread:   Message in/out detection

9/24/2005 6:57:17 PM    Outlook doesn't know CommandBars
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.



9/25/2005 11:09:05 AM    Re: Outlook doesn't know CommandBars
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.  
  
"Randy Harris" <randy@nospam.com> wrote in message  
  
news:%23UKoQtVwFHA.3236@TK2MSFTNGP14.phx.gbl...

9/25/2005 4:09:19 PM    Re: Outlook doesn't know CommandBars
"neo [mvp outlook]" <neo@online.mvps.org> wrote in message  
  
news:%23hHa4wfwFHA.2924@TK2MSFTNGP15.phx.gbl...  
  
their  
  
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.

9/25/2005 4:43:28 PM    Re: Outlook doesn't know CommandBars
"Randy Harris" <randy@nospam.com> wrote in message  
  
news:%23iQOE0gwFHA.2540@TK2MSFTNGP09.phx.gbl...  
  
or  
  
Is it even possible to reference CommanBars on Item windows that aren't  
  
open?

9/26/2005 5:26:43 AM    Re: Outlook doesn't know CommandBars
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.  
  
"Randy Harris" <randy@nospam.com> wrote in message  
  
news:e$a7JHhwFHA.3300@TK2MSFTNGP09.phx.gbl...

9/26/2005 11:22:09 AM    Re: Outlook doesn't know CommandBars
"neo [mvp outlook]" <neo@online.mvps.org> wrote in message  
  
news:OBkrOWpwFHA.3080@tk2msftngp13.phx.gbl...  
  
The  
  
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.

9/26/2005 12:25:41 PM    Re: Outlook doesn't know CommandBars
I would pull down the ItemsCB sample at Microeye.  The link is  
  
http://www.microeye.com/resources/itemsCB.htm and it is a very good example  
  
on how to work with command bars.  (hint: you will be creating a sink to  
  
watch for NewInspectors.)  
  
"Randy Harris" <randy@nospam.com> wrote in message  
  
news:OUhGR4qwFHA.2620@TK2MSFTNGP09.phx.gbl...