L
lanem
Here's the code I'm using to create a button on the standard toolbar in an
open email in outlook. The event is firing, b/c I get the "New Inspector"
msgbox to appear, but then I always get "error creating button". This code
for creating a button works in the main outlook window, but it does not when
an email is opened in a new window. Please help.
Private Sub myOlInspectors_NewInspector(ByVal Inspector As
Outlook.Inspector) Handles myOlInspectors.NewInspector
MsgBox("New Inspector")
' Create button on Standard Toolbar in Outlook when Outlook starts
Dim objStandardBar As CommandBar
Try
objStandardBar = Inspector.CommandBars.Item("Standard")
btnCombine =
CType(objStandardBar.Controls.Add(Type:=MsoControlType.msoControlButton,
Temporary:=True), CommandBarButton)
btnCombine.Caption = "Click me"
btnCombine.Style = MsoButtonStyle.msoButtonCaption
btnCombine.Visible = True
Catch ex As Exception
MsgBox("Error creating button.", MsgBoxStyle.Critical, "Error")
End Try
End Sub
open email in outlook. The event is firing, b/c I get the "New Inspector"
msgbox to appear, but then I always get "error creating button". This code
for creating a button works in the main outlook window, but it does not when
an email is opened in a new window. Please help.
Private Sub myOlInspectors_NewInspector(ByVal Inspector As
Outlook.Inspector) Handles myOlInspectors.NewInspector
MsgBox("New Inspector")
' Create button on Standard Toolbar in Outlook when Outlook starts
Dim objStandardBar As CommandBar
Try
objStandardBar = Inspector.CommandBars.Item("Standard")
btnCombine =
CType(objStandardBar.Controls.Add(Type:=MsoControlType.msoControlButton,
Temporary:=True), CommandBarButton)
btnCombine.Caption = "Click me"
btnCombine.Style = MsoButtonStyle.msoButtonCaption
btnCombine.Visible = True
Catch ex As Exception
MsgBox("Error creating button.", MsgBoxStyle.Critical, "Error")
End Try
End Sub