Private Sub AddToolbar()
Try
Dim objBar As Office.CommandBar
OL = Me.Application
objBar = OL.ActiveExplorer.CommandBars.Item("Standard")
objButton = objBar.Controls.Add(, , , 1, True)
With objButton
.Picture = getImage()
.Mask = getImage()
.TooltipText = "eConfirm"
.Caption = "eConfirm"
.Style = msoButtonIconAndCaption ' msoButtonIcon
End With
Catch ex As System.Exception
MsgBox("Failed to add button" & ex.ToString())
End Try
End Sub
Private Sub objButton_Click(ByVal Ctrl As Office.CommandBarButton, _
ByRef CancelDefault As Boolean) Handles objButton.Click
MsgBox("Hello World")
End Sub
Comments