onDisconnection

  • Thread starter Thread starter Lars Roland
  • Start date Start date
L

Lars Roland

Hi I am having problems with my com addin to outlook - it does not use
any Explorer or Inspector, so I think I should be able to do the unloading
inside the onDisconnection.


I have the following four buttons

-------------------------------------------------------
Dim WithEvents previewButton As Office.CommandBarButton
Dim WithEvents reportSpamButton As Office.CommandBarButton
Dim WithEvents reportHamButton As Office.CommandBarButton
Dim WithEvents copyButton As Office.CommandBarButton
-------------------------------------------------------


My onDisconnection sub looks like

-------------------------------------------------------
Dim oOL As Object

Public Sub AddinInstance_OnDisconnection(ByVal RemoveMode As _
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)

'resume on error
On Error Resume Next

oOL.CommandBars("Standard").Controls.Item("Copy Message Source to Clipboard").Delete
oOL.CommandBars("Standard").Controls.Item("Preview Message").Delete
oOL.CommandBars("Standard").Controls.Item("Report Spam").Delete
oOL.CommandBars("Standard").Controls.Item("Report Ham").Delete
Set previewButton = Nothing
Set reportSpamButton = Nothing
Set reportHamButton = Nothing
Set copyButton = Nothing
Set oOL = Nothing
End Sub
 
Unless Outlook is running with no UI at all there certainly is at least 1
Explorer.

On_Disconnection will *not* fire when the user closes Outlook if any of your
Outlook objects are still instantiated. It will only fire after you release
them all. See the ItemsCB COM addin sample (VB6) on the Resources page at
www.microeye.com for an example of a COM addin template that handles that
and other common Outlook COM addin bugs in a best practices way.
 
Back
Top