I have used to following code to create custom buttons on the standard toolbar.
Function AddToolbarButton(Caption As String, _
toolTip As String, macroName As String, _
Optional toolbarName As String = "Standard", _
Optional FaceID As Long = 325, Optional buttonTag As String, Optional objIndex As Integer)
Dim objBar As Office.CommandBar
Dim objButton As Office.CommandBarButton
Set objBar = ActiveExplorer.CommandBars(toolbarName)
Set objButton = objBar.Controls.Add(Type:=msoControlButton, Before:=objIndex)
With objButton
.Caption = Caption
.OnAction = macroName
.TooltipText = toolTip
.FaceID = FaceID
.Style = msoButtonIconAndCaption
.BeginGroup = True
.Tag = buttonTag
End With
End Function
Sub AddToolBarButtons()
Dim objBar As Office.CommandBar
Set objBar = ActiveExplorer.CommandBars("Standard")
Set tstButton1 = objBar.FindControl(Tag:="New Secure")
Set tstButton2 = objBar.FindControl(Tag:="Reply Secure")
Set tstButton3 = objBar.FindControl(Tag:="Reply All Secure")
Set tstButton4 = objBar.FindControl(Tag:="Forward Secure")
If tstButton1 Is Nothing Then
Call AddToolbarButton("New Secure", "New Secure", "NewSecure", , "1981", "New Secure", 2)
Else
MsgBox "New Secure Already Exists"
End If
If tstButton2 Is Nothing Then
Call AddToolbarButton("Reply Secure", "Reply Secure", "ReplySecure", , "354", "Reply Secure", 8)
Else
MsgBox "Reply Secure Already Exists"
End If
If tstButton3 Is Nothing Then
Call AddToolbarButton("Reply All Secure", "Reply All Secure", "ReplyAllSecure", , "355", "Reply All Secure", 10)
Else
MsgBox "Reply All Secure Already Exists"
End If
If tstButton4 Is Nothing Then
Call AddToolbarButton("Forward Secure", "Forward Secure", "ForwardSecure", , "356", "Forward Secure", 12)
Else
MsgBox "Forward Secure Already Exists"
End If
End Sub
My problem is that when I double click and open an email the standard toolbar changes to no longer include these buttons. All I have is the Reply, Reply All, and Forward Buttons.
I would like to have the Reply Secure, Reply All Secure and Forward Secure buttons to appear on the standard toolbar when an email is open.
Any help is appreciated.