Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook COM addin

Status
Not open for further replies.

andywho

Programmer
Sep 11, 2002
1
JP
Hi all,

My COM addin for microsoft Outlook doesn't want to trigger the event handler when clicked...... The code is below. anyone have any idea why it would not trigger



------------------------------------------------------------

Implements Extensibility.IDTExtensibility2

Dim WithEvents oApp As Outlook.Application
Dim WithEvents oCB As Office.CommandBarButton
Dim WithEvents oCBs As Office.CommandBars
Dim oMenuBar As Office.CommandBar

Dim isControl As Object
Dim WithEvents oMyCB As Office.CommandBarButton
Dim WithEvents oResetCB As Office.CommandBarButton


Private Sub oMyCB_Click(ByVal Ctrl As Office.CommandBarButton, ByVal CancelDefault As Boolean)

MsgBox("You clicked me!")
End Sub


Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnBeginShutdown
oApp = Nothing
oCBs = Nothing
oMenuBar = Nothing
oMyCB = Nothing

oCB = Nothing
oResetCB = Nothing


End Sub

Public Sub OnDisconnection(ByVal RemoveMode As Extensibility.ext_DisconnectMode, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnDisconnection
oMyCB.Delete()
oMenuBar.Delete()
End Sub

Public Sub OnConnection(ByVal application As Object, ByVal connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnConnection

MsgBox("OnConnection called")
' Get the Application object for Outlook.
oApp = application


' Customize the Outlook Menu structure and toolbar.
oCBs = oApp.ActiveExplorer.CommandBars



oMenuBar = oCBs.Add("SaveIT", 3, False, False)
oMenuBar.Visible = True
On Error GoTo error2

oMyCB = oMenuBar.Controls.Add(Type:=1, Temporary:=False)
oMyCB.Caption = "&SaveIT"
oMyCB.Tag = "SaveITTag"

oMyCB.Style = 2
oMyCB.Visible = True
oMyCB.Enabled = True
oMyCB.OnAction = &quot;!<&quot; & addInInst.ProgId & &quot;>&quot;



End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top