CommandBars - Error in loading DLL

  • Thread starter Thread starter john
  • Start date Start date
J

john

Get "Error in Loading DLL" when accessing the CommandBars
collection. Here is the code:

Dim ol As New Outlook.Application
Dim myInspector As Inspector
Set myInspector = ol.ActiveInspector
Set MyCB = myInspector.CommandBars("item")

Any ideas?
 
I am not 100% sure that you can do it this way (please correct me if I am
wrong) - In an COM addin I usuly use the onConncetion event to get ny
hands on the Outlook.application object. Using this object i can do

olApp.ActiveExplorer.CommandBars("cmdName")

I noticed that you try to get your hands on an commandbar called item -
are you working with the itemCB from microeye ?? - if you are, then look
inside OutAddIn.cls for the InitHandler and CBOutlookItems methods - these
will show you how to do what you want.
 
In addition to the tips from Lars, you must check whether you even have an
ActiveInspector:

If Not myInspector Is Nothing Then
Set MyCB = myInspector.CommandBars("item")
If Not MyCB Is Nothing Then
' it's safe to do stuff with MyCB
End If
End If
 
I don't even get to the point of running the code; it is a
compile error with CommandBars hilighted. CommandBars is
available in the intellisense dropdown list. Could this
be a DLL version issue?
 
Did you add the Office library to your project? CommandBars is an Office
object, not an Outlook object.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Yes. Outlook 10.0, Office 9.0, SafeOutlook (redemption).
Accessing CommandBars with macros in Word and Excel works
fine; Outlook giving this problem. ??
 
DLL mismatches maybe. I've never seen a combo of Office 9 and Outlook 10 be
compatible with using WordMail and it might not be compatible when trying to
use CommandBars.
 
Back
Top