Hallo,

 

ich habe auf der Grundlage dieses MS-Beitrages

 

http://www.microsoft.com/germany/msdn/library/office/EntwickelnVonNETSmartClientsFuerMicrosoftOfficeXPTeil1.mspx

 

ein AddIn mit VB.NET 2003 für Outlook 2003 entwickelt. Das ganze klappt auch wunderbar.

Nachdem ich einen neue Symbolleiste in Outlook benötige, habe ich die „Connect-Klasse“ folgendermaßen abgeändert:

 

---

Public Class Connect

           

            Implements Extensibility.IDTExtensibility2

           

            Dim applicationObject as Object

    dim addInInstance as object

 

    Dim WithEvents oApplication As Microsoft.Office.Interop.Outlook.Application

    Dim WithEvents oCreateAccountBHandler As Microsoft.Office.Core.CommandBarButton

    Dim oCommandBar As CommandBar

 

 

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

            End Sub

           

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

            End Sub

           

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

        MsgBox("TEST")

 

        Dim oCommandBars As Microsoft.Office.Core.CommandBars

        Dim oCommandBars2 As Microsoft.Office.Core.CommandBar

        Dim oControls As Microsoft.Office.Core.CommandBarControls

        Dim oControl As Microsoft.Office.Core.CommandBarButton

 

        oCommandBars = oApplication.ActiveExplorer.CommandBars

        oCommandBar = oCommandBars.Add("Eigene Systemleiste", Temporary:=False)

        oControl = oCommandBar.Controls.Add(Type:=MsoControlType.msoControlButton, ID:=1, Temporary:=False)

        oControl.Caption = "CNA"

        oControl.FaceId = 609

        oControl.Style = MsoButtonStyle.msoButtonIconAndCaption

        oCreateAccountBHandler = oControl

        oCommandBar.Visible = True

        oCommandBar.Position = MsoBarPosition.msoBarLeft

 

    End Sub

 

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

    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

        applicationObject = application

        addInInstance = addInInst

 

    End Sub

 

End Class

---

 

Die MsgBox gibt zwar den Text „TEST“ aus, aber die Symbolleiste „Eigene Symbolleiste“ wird leider nicht erstellt.

Kann mir jemand bitte sagen, wo in dem Listing der Fehler liegt?

 

Dank und Grüße

 

Oskar

 

Odpovedet emailem