Const msoButtonIconAndCaption = 3
Public WithEvents myOlInspectors As Outlook.Inspectors
Private Sub myOlInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
Dim olkBar As Object, olkControl As Object
If Inspector.CurrentItem.Class = olMail Then
Set olkBar = Inspector.CommandBars.Item("Standard")
'Test to see if the toolbar button already exists
Set olkControl = olkBar.FindControl(, , "ForwardWithVoting")
'If not found, then create button
If olkControl Is Nothing Then
Set olkControl = olkBar.Controls.Add(, , , 7, True)
With olkControl
.Caption = "Forward with Voting"
'Change the FaceId value on the next line'
.FaceId = 1676
.Style = msoButtonIconAndCaption
.Tag = "ForwardWithVoting"
.Visible = True
End With
End If
Set olkBar = Nothing
End If
End Sub
Private Sub Application_Quit()
Set myOlInspectors = Nothing
End Sub
Private Sub Application_Startup()
Set myOlInspectors = Application.Inspectors
End Sub
That's pretty simple. Here's the code for automatically creating a forward with the voting buttons. Please try it out and if it's okay, then I'll explain how to add the button for firing it. To use this
1. Add the code to Outlook
2. Open a message
3. Run the macro
Open in new window