Outlook-CommandBarButton still there - even on Outlook.Explorer.Close

R

René Meinecke

Hi there,

still the same problem but now with other code. I´m using VB.NET now and the
code is:

Dim WithEvents btnAntrago As Office.CommandBarButton

Private WithEvents expclOutlook As Outlook.ExplorerClass

Public Sub OnStartupComplete(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnStartupComplete

Dim cbarsOffice As Office.CommandBars

Dim cbarOffice As Office.CommandBar

expclOutlook = appOutlook.ActiveExplorer()

On Error Resume Next

cbarsOffice = appOutlook.CommandBars

If cbarsOffice Is Nothing Then

cbarsOffice = expclOutlook.CommandBars()

End If

cbarOffice = cbarsOffice.Item("Standard")

btnAntrago = cbarOffice.Controls.Item(strTitle)

If btnAntrago Is Nothing Then

btnAntrago = cbarOffice.Controls.Add(1)

With btnAntrago

..Caption = strTitle

..Style = Office.MsoButtonStyle.msoButtonCaption

..Tag = strTitle

..OnAction = "!<ANTRAGO_EMail_AddIn.Connect>"

End With

End If

End Sub



Private Sub expOutlook_Close() Handles
expclOutlook.ExplorerEvents_Event_Close

btnAntrago.Delete()

btnAntrago = Nothing

expclOutlook = Nothing

End Sub



peace René
 
R

René Meinecke

Hi,

thanks for your answer. Now the button disappears on Outlook exit.

Thx René
 

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