> Don't try to activate the Inspector in the NewInspector event handler.
> Handle the Inspector events and in the Activate event create your toolbar.
>
> --
> Ken Slovak
> [MVP - Outlook]
>
http://www.slovaktech.com> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
>
http://www.slovaktech.com/products.htm>
>
> "Paul Heinisch" <PaulHeinisch[ at ]discussions.microsoft.com> wrote in message
> news:4E0378C2-B0AA-432C-B773-39BB42F4AA39[ at ]microsoft.com...
> > Public Class Connect
> >
> > Implements Extensibility.IDTExtensibility2
> >
> > Dim oApp As outlook.Application
> > Dim addInInstance As Microsoft.Office.Core.COMAddIn
> > Dim newToolBar As office.CommandBar
> > Dim WithEvents firstButton As office.CommandBarButton
> >
> > Dim WithEvents selectInspector As outlook.Inspectors
> >
> >
> > 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
> >
> > selectInspector = oApp.Inspectors
> > AddHandler selectInspector.NewInspector, AddressOf
> > Me.NewInspector_Event
> >
> > 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
> > oApp = CType(application,
> > Microsoft.Office.Interop.Outlook.Application)
> > addInInstance = CType(addInInst, Microsoft.Office.Core.COMAddIn)
> >
> > End Sub
> >
> > Private Sub NewInspector_Event(ByVal new_Inspector As
> > outlook.Inspector)
> >
> > new_Inspector.Activate()
> > newToolBar = Nothing
> > Call Me.AddToolbar()
> >
> >
> > End Sub
> >
> > Private Sub AddToolbar()
> > Try
> >
> > Dim button_1 As office.CommandBarButton
> >
> > If newToolBar Is Nothing Then
> > Dim cmdBars As office.CommandBars =
> > oApp.ActiveInspector().CommandBars
> > newToolBar = cmdBars.Add("NewToolBar",
> > office.MsoBarPosition.msoBarTop, False, True)
> > End If
> > Try
> > button_1 = CType(newToolBar.Controls.Add(1),
> > office.CommandBarButton)
> > With button_1
> > .Style = office.MsoButtonStyle.msoButtonCaption
> > .Caption = "Button 1"
> > .Tag = "Button1"
> > End With
> > If Me.firstButton Is Nothing Then
> > Me.firstButton = button_1
> > AddHandler firstButton.Click, AddressOf buttonClick
> > End If
> >
> > newToolBar.Visible = True
> > Catch ex As Exception
> > MsgBox(ex.Message)
> > End Try
> > Catch ex As Exception
> > MsgBox(ex.Message)
> > MsgBox(ex.StackTrace)
> > End Try
> > End Sub
> >
> >
> >
> > Private Sub buttonClick(ByVal ctrl As office.CommandBarButton, ByRef
> > Cancel As Boolean)
> > MsgBox("You clicked: " + ctrl.Caption)
> > End Sub
> >
> >
> >
> >
> > End Class
>
>