This article applies to:
Outlook 2016, Office VBA
In this document I will show you how to create a custom ribbon button in Outlook.
We will create a simple button that adds a tag [SecureMail] to the subject of a new email message.
In order to achieve this, we have to complete following major steps.
- Enable developer features in Outlook.
- Write a macro which will do the modification of the subject.
- Create a custom group/button in the Outlook ribbon.
- Attach the macro to the button.
Here are the detailed steps:
1) Enable the Developer Tab in Outlook. Open File->Options->Customize Ribbon. Check the Developer Tab.
2) Click on the Developer Tab.
3) Select Visual Basic.
4) Select Project1->Microsoft Outlook Objects->ThisOutlookSession
5) Paste the following code into the editor:
6) Click on the Save button to save your macro and close Editor.
Now we need to attach your macro to a button on the Ribbon.
7) Open the New Message dialog by clicking on the New Message button.
8) Right-click on the empty part of the ribbon and select Customize the Ribbon…
9) Select New Mail Message and press the New Group button
10) Give a name to your new group by selecting New Group (Custom) and select the Rename.
11) Give it a name let’s say Secure Mail.
Now we will create our custom button and attach the macro we created to this button.
12) Select Choose Command from -> Macros
13) Select the Macro you created and by pressing Add attach it to your custom button.
14) Select the new button and press the Rename button to rename it.
15) Enter a name for your button and select an icon.
In the New Mailbox dialog box we now have a new icon group called Secure Mail and a button named Add SecureMail to Subject.
And if we press it, the text [SecureMail] will be added to the Subject as expected.