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 = "!<" & addInInst.ProgId & ">"
End Sub
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 = "!<" & addInInst.ProgId & ">"
End Sub