Note: The other languages of the website are Google-translated. Back to English
English English

How to create a drop-down list for subjects in Outlook?

You may have different preset email subjects that need to be distributed to different recipients in Outlook. It would be very efficient to have a subject line drop-down list for selecting a subject without typing it manually when composing an email. Just like the gif demonstrated below. This tutorial provides three VBA codes to help you create a drop-down list with different preset subjects. When composing an email, you can select any subject you need from the drop-down to automatically fill in the subject line. Please follow the step-by-step guide to get it done.


Create a drop-down list for subjects in Outlook with VBA code

Actually, Outlook does not allow to add a drop-down list in the subject line. Here you need to create a user form and combine it with VBA codes to complete it.

1. Launch your Outlook, press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. In the Microsoft Visual Basic for Applications window, click Insert > UserForm.

3. Then the UserForm1 is inserted under Project1 in the left pane of the Visual Basic editor. You need to add a combo box and a command button to this userform by dragging the ComboBox and CommandButton respectively from the Toolbox to the UserForm1.

4. Right click the command button and select Properties in the right-click menu.

5. In the Properties – CommandButton1 pane, change the Caption field to OK. This action will change the text displayed on the command button.

6. Double click on the blank area in the UserForm to open the corresponding UserForm (Code) window, then replace the existing code with the following VBA code.

VBA code 1: UserForm with a drop-down list including multiple preset email subjects

Private Sub UserForm_Initialize()
'Updated by Extendoffice 20220927
  With ComboBox1
    .AddItem "Subject 1"
    .AddItem "Subject 2"
    .AddItem "Subject 3"
    .AddItem "Subject 4"
    .AddItem "Subject 5"
    .AddItem "No change"
  End With
End Sub

Private Sub CommandButton1_Click()
  GCbbIndex = ComboBox1.ListIndex
  GSelSubject = ComboBox1.Value
  Unload Me
End Sub

Note: In the code, the Subject 1, 2, 3, 4 and 5 are the preset email subjects you want to use in your emails. “No change” means not change anything of the existing email subject. You can change the preset email subjects in the VBA code according to your needs.

7. Double click Project1 > Microsoft Outlook Objects > ThisOutlookSession. Then copy the following VBA code into the ThisOutlookSession (Code) window.

VBA code 2 used in the ThisOutlookSession window

Public WithEvents GExplorer As Explorer
'Updated by Extendoffice 20220927
Private Sub Application_Startup()
  Set GExplorer = Application.ActiveExplorer
End Sub

Private Sub GExplorer_InlineResponse(ByVal Item As Object)
  Set GInlineMail = Item
End Sub

8. Go on clicking Insert > Module in the Visual Basic editor. Then copy and paste the following VBA code into the Module (Code) window.

VBA code 3 used in the Module window

Public GCbbIndex As Long
'Updated by Extendoffice 20220927
Public GSelSubject As String
Public GInlineMail As MailItem
Public Sub ChangeSubject()
  Dim xItem As MailItem
  Dim xMail As Outlook.MailItem
  On Error Resume Next
  Select Case TypeName(Application.ActiveWindow)
    Case "Explorer"
      Set xMail = GInlineMail
      Debug.Print "Explorer"
    Case "Inspector"
      Set xMail = Application.ActiveInspector.CurrentItem
      Debug.Print "Inspector"
  End Select
  UserForm1.Show
  If (GCbbIndex <> -1) And (GSelSubject <> "no change") Then
    xMail.Subject = GSelSubject
  End If
End Sub

9. Save the codes and press the Alt + Q keys to close the Visual Basic Editor window and return to Outlook application.

10. Click the New Email button under the Home tab to create an email.

11. In the new message window, click Customize Quick Access Toolbar > More Commands.

12. In the Outlook Options dialog box, you need to configure as follows.

12.1) Select Macros in the Choose commands from drop-down list;
12.2) Select Project1.ChangeSubject in the commands list box;
12.3) Click the Add button;
12.4) Click the OK button. See screenshot:

13. Then you can see that a button has been added to the ribbon of the message window.

14. Now you need to restart your Outlook.

15. When composing an email message, if you need to insert a preset subject, you just need to click on the newly added button on the ribbon to display the user form, select a subject from the drop-down menu, and then click the OK button to populate it into the subject line.

Notes:

1) You can change the existing subject with any subject selected in the drop-down list;
2) This method works well when replying to or forwarding an email in a new window;
3) If you tend to reply to emails in-line from the reading pane rather than opening a separate window, you can bring up the user form as follows.
3.1) Click Developer > Macros > Project1.ChangeSubject. See screenshot:

3.2) When the user form pops up, select a preset subject from the drop-down list and click the OK button, the original subject will be changed immediately.

4) If you select No change in the drop-down menu, the original subject will be retained without any changes.

Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
 
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations