• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Macro to Warn Before Sending a Message with a Blank Subject

Slipstick Systems

› Outlook › Email › Macro to Warn Before Sending a Message with a Blank Subject

Last reviewed on May 23, 2017     35 Comments

Applies to: Outlook 2007

Outlook 2010 and newer will check messages for a blank subject automatically, a macro is not needed.
Blank subject warning
Surprisingly, some users hate this but there is no way to disable it in Outlook Options. If want to disable this warning, you can disable the warning using a macro.

Anyone using Outlook 2007 or older who wants a warning when the subject line is blank needs to use a macro.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
 Dim strSubject As String
  strSubject = Item.Subject
     If Len(Trim(strSubject)) = 0 Then
         Prompt$ = "Subject is Empty. Are you sure you want to send the Mail?"
       If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for Subject") = vbNo Then
        Cancel = True
      End If
    End If
End Sub

How to use this macro

Using a macro in Outlook, short version:

  1. Step 1: Enable macros in Tools, Macro Security or Tools, Trust Center (Outlook 2007). We recommend the 'warn for all macros' setting (Medium in Outlook 2003 and older). With this enabled, you'll need to allow macros each time you start Outlook. In older versions of Outlook, you may need to close and restart Outlook before the macros will work.
    Allow macros to run

  2. Step 2: Open the VBA Editor using Alt+F11 keystroke.
  3. Step 3: Expand the Project menu and select ThisOutlookSession
  4. Step 4: Copy and paste the macro into ThisOutlookSession. The text should be blue, green and black. Red text means there is a syntax error in that line.
  5. Step 5: Save (Ctrl+S or Save button). Note: you'll need to save the VBA project when you close Outlook too.

Test the macro by sending a message with a blank subject.

Blank subject warning

If it works as expected, you can use SelfCert to sign the macro then set Outlook's macro security to signed macros only. Instructions for using SelfCert are available at How to use Outlook’s VBA Editor

Warn before doing other stuff...

You can use this to warn about things beside a blank subject. Depending on what you are checking, you will need to either remove or edit the first two lines:

Dim strSubject As String
strSubject = Item.Subject

Then change the IF statement to test the field you want to test:
If Len(Trim(strSubject)) = 0 Then

For example, to check the TO address, we need to change those lines to this:
'Item = MailItem
If Item.To = "alias@domain.com" Then

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

   'Item = MailItem
     If Item.To = "alias@domain.com" Then
         Prompt$ = "Are you sure you want to send this message?"
       If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check before Sending") = vbNo Then
        Cancel = True
      End If
    End If
End Sub

More code samples are available at

Warn Before Sending Messages to the Wrong Email Address

More Information

More Code Samples:
E-Mail: Check item size before sending

Macro to Warn Before Sending a Message with a Blank Subject was last modified: May 23rd, 2017 by Diane Poremsky

Related Posts:

  • Check for missing attachments before sending a message
  • Do You Want to Send This Message Without a Subject?
  • Warn Before Sending: Checking Contact Categories
  • Disable Outlook's No Subject Warning using VBA

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Subscribe
Notify of
35 Comments
newest
oldest most voted
Inline Feedbacks
View all comments

Dennis Parteka (@guest_206660)
May 21, 2017 11:28 am
#206660

I see this code all over the internet and everyone says how wonderful
it works but it doesn't work for me, I'm clueless, any ideas why? I'm not
getting an error, it just seems to not run the macro. Windows 7 Office 2010.

Image 1.jpg
Image 2.jpg
0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  Dennis Parteka
May 23, 2017 12:35 am
#206678

it definitely won't show in the macro list (first screen shot) - it's an auto macro and will run when you send a message. You don't need to do anything to make it run (but click Send).

Do you have macro security set to low? That is the usualy cause...

(I'll try to record a video showing how to do it and it in action tomorrow. )

0
0
Reply
Dennis Parteka (@guest_206686)
Reply to  Diane Poremsky
May 23, 2017 7:09 am
#206686

Thank you for responding and for your help, I really appreciate it.
Yes, security is as low as possible. I’ve tried running this on
Windows-7 Office 2010 and Windows-10 Office 2016 and also tried
changing the fourth line… it’s driving me a little nutty.
From… If Len(Trim(strSubject)) = 0 Then
To… If Len(Trim(strSubject)) = "No" Then

Security Setting.jpg
0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  Dennis Parteka
May 23, 2017 8:52 am
#206688

Now wait a minute - why do you need this with either outlook 2010 or 2016? It has the warning built in - you should get this dialog box. If you also use the macro, it will come up after this one.

Blank subject warning
0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  Dennis Parteka
May 23, 2017 1:07 pm
#206695

oh, i see the problem - len is length.
Use this instead
If InStr(1, strSubject, "Phrase") > 0 Then

If there is any chance any letter in the string could be a different case, use lowercase for everything:
If InStr(1, lcase(strSubject), "phrase") > 0 Then

0
0
Reply
Tai (@guest_200455)
August 4, 2016 6:19 pm
#200455

I created a request form with fields for users to enter in Outlook. However, I would like all the fields to be entered prior to the form getting sent. How can I prompt a message box stating "Please enter all the fields" when the user is trying to send the form with one or more blank fields?

0
0
Reply
Navdeep (@guest_199585)
June 24, 2016 6:17 am
#199585

1.Is there is way to add any prompt on recieving any mail in Outlook.For exaple.
Do you want to archieve this mail.
2.On Yes, I want to use our own Product calls to archieve emails in repository.
3. Once Archieved , Flag of mail should be marked stating that mail has been archieved in repository.?

0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  Navdeep
June 25, 2016 12:21 am
#199603

Do you want the prompt as the mail arrives? if so, an itemadd macro can do the prompt and the flag. Whether it can use your archiving software depends on the software.

0
0
Reply
Ken (@guest_194412)
November 2, 2015 2:13 pm
#194412

I use a template in outlook 2007 where I need to edit the subject every time before I send it. In the template, the subject is "Ticket #". What is the code to get a prompt before sending out a message with a specific subject? I want it to warn me if I forget to edit the subject of the template. So If the subject = "Ticket #" then prompt me if I want to send out the email.

0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  Ken
November 4, 2015 8:45 am
#194453

use this - first 8 characters = ticket # to prompt for all messages that begin with ticket #. if you wanted to warn only if there was not something after ticket #, use the second one, 10 would allow for 2 digit or larger ticket #. That can be increased.
If Left(strSubject, 8) = "Ticket #" Then
If Left(strSubject, 8) = "Ticket #" and Len(Trim(strSubject)) < 10 Then

0
0
Reply
Don (@guest_193797)
October 6, 2015 7:04 pm
#193797

I would like to applaud you for following up on comments from an almost three yr old post!

I am trying to modify a subject to apply some leading text (to encrypt via our servers) to emails sent to any address besides two specific ones. I modified the code based off something I found online a while ago to just add the encrypt text to everything, but it gets kind of messy with some people's filters. Below is the code, any thoughts how to fix it? Thank you in advance!

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

If (Right(Trim(Item.To), 15)) "@exampleone.com" Then
Item.Subject = Item.Subject
ElseIf (Right(Trim(Item.To), 15)) "@exampletwo" Then
Item.Subject = Item.Subject
Else
If (Left(Trim(Item.Subject), 8)) "SECURE: " Then
Item.Subject = "SECURE: " + Item.Subject
End If
End If
End Sub

0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  Don
October 6, 2015 9:50 pm
#193802

The macro at https://www.slipstick.com/developer/code-samples/add-secure-message-subject-sending/ uses a cleaner method if you need to exclude multiple domains and also check all of the recipient addresses.

Not sure the purpose of this - if the subject has secure, it doesn't need it added. Oh, i bet wordpress ate the 'does not equal brackets' <>
If (Left(Trim(Item.Subject), 8)) "SECURE: " Then
Item.Subject = "SECURE: " + Item.Subject

These could be combined into an OR... but the else works too. just exit sub and send if the statement is true.
If (Right(Trim(Item.To), 15)) "@exampleone.com" Then
exit sub
ElseIf (Right(Trim(Item.To), 15)) "@exampletwo" Then
exit sub

Else
If (Left(Trim(Item.Subject), 8)) <> "SECURE: " Then
Item.Subject = "SECURE: " + Item.Subject

0
0
Reply
Don (@guest_193819)
Reply to  Don
October 7, 2015 6:03 pm
#193819

That was prefect. Thank you!

0
0
Reply
Don (@guest_193820)
Reply to  Don
October 7, 2015 6:08 pm
#193820

Is there a way to add if the address is an Exchange address, as those do not show domains? Thank you!

0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  Don
October 10, 2015 12:15 am
#193880

So you want it to trigger for any internal email address? Try looking for /ou in the address or "" (nothing). if that fails, you couls look up the pr_smpt_address - 'Check for different domains' macro at https://www.slipstick.com/how-to-outlook/prevent-sending-messages-to-wrong-email-address/ shows how.

0
0
Reply
Deepa (@guest_191695)
July 2, 2015 11:31 am
#191695

can you help me with the code for warning message "Please read the email or check the attachment before sending"

0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  Deepa
July 2, 2015 1:18 pm
#191698

if you want to check all mail, remove the If and End if lines. Change the text within the prompt string.

0
0
Reply
Mark (@guest_191159)
June 1, 2015 2:55 pm
#191159

Diane,

If I just want a macro to stop any and every email before I send it so I can check it one more time, what would I do? I'm not checking for a specific field. Rather, I simply want a "speed bump" with text in the pop up that makes me reconsider sending it or allows me to cancel if I'm not sure.

I've done this before, looking at your site (I think) but I've forgotten now that I switched to a new computer.

0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  Mark
July 2, 2015 1:22 pm
#191699

If you remove the IF and end if lines, it'll check all messages.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Prompt$ = "Are you sure you want to send this message?"

If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check before Sending") = vbNo Then
Cancel = True
End If

End Sub

0
0
Reply
rohitrajsbl (@guest_188050)
December 8, 2014 12:10 pm
#188050

Hi Everyone,
I want to create a Macro in outlook 2013. If I am attaching anything in email then a popup box should appear with the statement “You are attaching a file. Please check if XYZ field available in the file” Presse YES or NO. Also in the popup box should be one check box If I checked the button then a note should be include with the email.

Please help me to solved this out.

0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  rohitrajsbl
January 7, 2015 1:33 am
#188529

That one is complicated and I don't have any macro samples that do that. Sorry.

0
0
Reply

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 30 Issue 15

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Use Classic Outlook, not New Outlook
  • How to Remove the Primary Account from Outlook
  • Disable "Always ask before opening" Dialog
  • Adjusting Outlook's Zoom Setting in Email
  • This operation has been cancelled due to restrictions
  • Remove a password from an Outlook *.pst File
  • Reset the New Outlook Profile
  • Maximum number of Exchange accounts in an Outlook profile
  • Save Attachments to the Hard Drive
  • How to Hide or Delete Outlook's Default Folders
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
  • Opening PST files in New Outlook
  • New Outlook: Show To, CC, BCC in Replies
  • Insert Word Document into Email using VBA
  • Delete Empty Folders using PowerShell
  • Warn Before Deleting a Contact
  • Classic Outlook is NOT Going Away in 2026
  • Use PowerShell to Delete Attachments
  • Remove RE:, FWD:, and Other Prefixes from Subject Line
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Opening PST files in New Outlook

New Outlook: Show To, CC, BCC in Replies

Insert Word Document into Email using VBA

Delete Empty Folders using PowerShell

Warn Before Deleting a Contact

Classic Outlook is NOT Going Away in 2026

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Newest Code Samples

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

Use PowerShell or VBA to get Outlook folder creation date

Rename Outlook Attachments

VBA Basics

How to use the VBA Editor

Work with open item or selected item

Working with All Items in a Folder or Selected Items

VBA and non-default Outlook Folders

Backup and save your Outlook VBA macros

Get text using Left, Right, Mid, Len, InStr

Using Arrays in Outlook macros

Use RegEx to extract message text

Paste clipboard contents

Windows Folder Picker

Custom Forms

Designing Microsoft Outlook Forms

Set a custom form as default

Developer Resources

Developer Resources

Developer Tools

VBOffice.net samples

SlovakTech.com

Outlook MVP David Lee

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2025 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.

wpDiscuz

Sign up for Exchange Messaging Outlook

Our weekly Outlook & Exchange newsletter (bi-weekly during the summer)






Please note: If you subscribed to Exchange Messaging Outlook before August 2019, please re-subscribe.

Never see this message again.

You are going to send email to

Move Comment