disconnecting com addin from Outlook 2K before Outlook closes

S

steve

Hi All

I have a com addin written in VB6 which I would like to disconnect as
Outlook is closing.

If I don't I get the microsoft message 'Microsoft outlook has encountered a
problem and needs to close'
Disconnecting the Addin from within Outlook first solves this problem.

I would thus like to do this in Outlook vba code.

I have tried the following in the Application.quit event....
Application.COMAddIns.Item("myAddin.Connect").Connect = False

I have also tried.....
Public WithEvents oexplorer As Outlook.Explorer

then in the oexplorer.close event
Application.COMAddIns.Item("myAddin.Connect").Connect = False

neither works

Any ideas?

regards
Steve
 
K

Ken Slovak - [MVP - Outlook]

If you have released all your Outlook objects then the On_Disconnection
event will fire automatically and Outlook and your addin will close. The
catch-22 in that is On_Disconnection will not fire when Outlook is closed by
the user (RemoveMode = ext_dm_HostShutdown) unless all your Outlook objects
have been released first.

Look at the ItemsCB COM addin template (VB 6) that illustrates an elegant
solution to the problem by tracking Explorers in an Explorer wrapper
collection and calls an UnInitHandler procedure that releases all your
Outlook objects so On_Disconnection can fire by tracking the closing of
Explorers. ItemsCB can be downloaded from a link on the Resources page at
www.microeye.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top