CommandBarButton Event Lost When Second Outlook Window Opened

  • Thread starter Thread starter jschmidt
  • Start date Start date
J

jschmidt

I have created a COM Addin that creates a command bar button. When mor
than one instance of Outlook is created the event continues to wor
with the first instance of Outlook, but does not work with the secon
instance (nothing happens when the button is clicked). Is there a wa
to re-hook the event when a new Outlook window is opened? I used th
following code to add my menu item and declare the variable for th
Command Button:

With mobjCmdBarCtrl.Controls

Set btnHolidayRequest = .Add(Type:=msoControlButton
Temporary:=False, Before:=1)

End With

The declaration for btnHolidayRequest is:

Public WithEvents btnHolidayRequest As CommandBarButto
 
There can only be 1 Outlook session running at a time. There can be multiple
Explorers open at once however and each can have its own CommandBars.

See the ItemsCB COM addin sample (VB 6) on the Resources page at
www.microeye.com for an Outlook COM addin template that handles multiple
Explorers in a wrapper collection of class modules. That sample also shows
the best practices for Outlook COM addins and common workarounds for bugs in
Outlook COM addins.
 
Back
Top