H
Hans Kaashoek
Hi all,
I created a com addin in outlook 2002 using office 2002 developer
When a new inspector , like a new mailitem, is opened the button
appears in a new toolbar, but when I click on this button nothing
happens (see code below).
What am I doing wrong?
thnx in advance
'Code starts Here
Implements IDTExtensibility2
Dim myOlapp As New Outlook.Application
Private WithEvents cmdBtn2 As Office.CommandBarButton
Public WithEvents myOlInspectors As Outlook.Inspectors
Public Sub Initialize_handler()
Set myOlInspectors = myOlapp.Inspectors
End Sub
Private Sub myOlInspectors_NewInspector(ByVal Inspector As
Outlook.Inspector)
On Error GoTo errh:
MsgBox "newinspector"
Dim cmdToolbar1 As CommandBar
Dim cmdBtn2 As CommandBarButton
Set cmdToolbar1 = Inspector.CommandBars.Add("Members DL1",
msoBarTop, , True)
cmdToolbar1.Visible = True
Set cmdBtn2 = cmdToolbar1.Controls.Add(Type:=msoControlButton)
cmdBtn2.Style = msoButtonCaption
cmdBtn2.Visible = True
cmdBtn2.Caption = "Select recipients from
distributionlist"
cmdBtn2.Tag = "cmdBtn2"
cmdBtn2.OnAction = ""
MsgBox "button"
Set cmdToolbar1 = Nothing '
Exit Sub
errh:
MsgBox er & " " & Err.Description & " " & Err.Number
Resume Next
End Sub
Private Sub cmdBtn2_Click(ByVal Ctrl As Office.CommandBarButton, _
CancelDefault As Boolean)
msgbox "jippie"
Load MembersDistributionList
MembersDistributionList.Show
End Sub
Private Sub IDTExtensibility2_OnAddInsUpdate(custom() As Variant)
End Sub
Private Sub IDTExtensibility2_OnBeginShutdown(custom() As Variant)
End SubInitialize_handler
Private Sub IDTExtensibility2_OnConnection(ByVal Application As
Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode,
ByVal AddInInst As Object, custom() As Variant)
Set myOlapp = Application
End Sub
Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
Set myOlapp = Nothing
Set cmdBtn2 = Nothing
End Sub
Private Sub IDTExtensibility2_OnStartupComplete(custom() As Variant)
End Sub
'End code
I created a com addin in outlook 2002 using office 2002 developer
When a new inspector , like a new mailitem, is opened the button
appears in a new toolbar, but when I click on this button nothing
happens (see code below).
What am I doing wrong?
thnx in advance
'Code starts Here
Implements IDTExtensibility2
Dim myOlapp As New Outlook.Application
Private WithEvents cmdBtn2 As Office.CommandBarButton
Public WithEvents myOlInspectors As Outlook.Inspectors
Public Sub Initialize_handler()
Set myOlInspectors = myOlapp.Inspectors
End Sub
Private Sub myOlInspectors_NewInspector(ByVal Inspector As
Outlook.Inspector)
On Error GoTo errh:
MsgBox "newinspector"
Dim cmdToolbar1 As CommandBar
Dim cmdBtn2 As CommandBarButton
Set cmdToolbar1 = Inspector.CommandBars.Add("Members DL1",
msoBarTop, , True)
cmdToolbar1.Visible = True
Set cmdBtn2 = cmdToolbar1.Controls.Add(Type:=msoControlButton)
cmdBtn2.Style = msoButtonCaption
cmdBtn2.Visible = True
cmdBtn2.Caption = "Select recipients from
distributionlist"
cmdBtn2.Tag = "cmdBtn2"
cmdBtn2.OnAction = ""
MsgBox "button"
Set cmdToolbar1 = Nothing '
Exit Sub
errh:
MsgBox er & " " & Err.Description & " " & Err.Number
Resume Next
End Sub
Private Sub cmdBtn2_Click(ByVal Ctrl As Office.CommandBarButton, _
CancelDefault As Boolean)
msgbox "jippie"
Load MembersDistributionList
MembersDistributionList.Show
End Sub
Private Sub IDTExtensibility2_OnAddInsUpdate(custom() As Variant)
End Sub
Private Sub IDTExtensibility2_OnBeginShutdown(custom() As Variant)
End SubInitialize_handler
Private Sub IDTExtensibility2_OnConnection(ByVal Application As
Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode,
ByVal AddInInst As Object, custom() As Variant)
Set myOlapp = Application
End Sub
Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
Set myOlapp = Nothing
Set cmdBtn2 = Nothing
End Sub
Private Sub IDTExtensibility2_OnStartupComplete(custom() As Variant)
End Sub
'End code