TheSmile
Mitglied
Hi,
ich willl ein COM-ADD-In fuer Outlook schreiben, und habe mir dafuer auch schon die entsprechenden Seiten der MSDN durchgelesen. Obwohl ich alles so gemacht habe, funktioniert es nicht.
Der Button und die Toolbar sind sichtbar, aber beim Klicken passiert nix, und da sollte eigentlich die MsgBox aufgehen.
Ich habe eine neues Projekt "AddIn" angelegt, und das Formular rausgeschmissen.
Dann habe ich im AddIn-Designer als Application Outlook angegeben, und auf Startup gesetzt.
Ich hab auch Microsoft Outlook 9.0 Object Library als Referenz dazugefuegt.
Thx for Help
Hier der Code:
ich willl ein COM-ADD-In fuer Outlook schreiben, und habe mir dafuer auch schon die entsprechenden Seiten der MSDN durchgelesen. Obwohl ich alles so gemacht habe, funktioniert es nicht.
Der Button und die Toolbar sind sichtbar, aber beim Klicken passiert nix, und da sollte eigentlich die MsgBox aufgehen.
Ich habe eine neues Projekt "AddIn" angelegt, und das Formular rausgeschmissen.
Dann habe ich im AddIn-Designer als Application Outlook angegeben, und auf Startup gesetzt.
Ich hab auch Microsoft Outlook 9.0 Object Library als Referenz dazugefuegt.
Thx for Help
Hier der Code:
Code:
Option Explicit
Private WithEvents objOLApp As Outlook.Application
Dim oCBs As Office.CommandBars
Dim oMenuBar As Office.CommandBar
Dim obutton1 As Office.CommandBarButton
Private Sub AddinInstance_OnConnection(ByVal Application As Object, _
ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object, custom() As Variant)
'Set my object to the host application.
Set objOLApp = Application
'Customize the Outlook Menu structure and toolbar
Set oCBs = objOLApp.ActiveExplorer.CommandBars
Set oMenuBar = oCBs.Add("My ToolBar", 1, False, True)
oMenuBar.Enabled = True
oMenuBar.Visible = True
Set obutton1 = oMenuBar.Controls.Add(msoControlButton, , , , True)
With obutton1
.Caption = "Export"
.ToolTipText = "Export selected Contact"
.Style = msoButtonCaption
.OnAction = "!<" & AddInInst.ProgId & ">"
.Enabled = True
.Visible = True
End With
End Sub
Private Sub obutton1_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
MsgBox "Exporting Contact from Outlook"
End Sub
Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As _
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
'Clean up objects that are created during the OnConnection event.
Set objOLApp = Nothing
End Sub
Zuletzt bearbeitet: