<

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Avoiding Blank Subject Lines in Outlook

Published on
30,294 Points
18,494 Views
18 Endorsements
Last Modified:
Awarded
Community Pick
Issue.  Have you ever received an email with a blank subject line?  Have you ever clicked "Send" only to realize that you forgot to add a subject?  It’s frustrating to receive a message with no subject.  You’ve no idea what the message is about, how important it is, whether it’s a legitimate message or spam, etc.  It’s even worse to send a message and forget to fill the subject in.  I’ve done it and I always feel foolish afterward.  I can’t help thinking what the recipients think.  This is especially true in a corporate environment where a message without a subject is downright unprofessional.

Background.  Unfortunately, Outlook does not enforce the use of the subject line or even offer an option for reminding you when you’ve forgotten to enter one.  From Outlook's perspective the subject is optional.

Solution.  Happily there’s a simple solution to this issue.  Through the use of a few lines of VBA (Visual Basic for Applications) code we can have Outlook check the subject line of every item we send.  If the subject line is blank, then the code can cancel the send and display a message asking us to give the item a subject.  Once the subject is filled in Outlook allows the item to go on its way.

Requirements.  This solution will work with any version of Outlook from 2000 through 2007.  Outlook 2010 adds a built-in check for a blank subject line (Note: Thanks to bromy2004 for pointing that out to me).  The solution does not work with Outlook Web Access (OWA).  OWA is Outlook in name only.  Unlike the full version of Outlook, OWA is a server-side process that runs at the Exchange server.  OWA does not support the use of VBA.

Instructions.  Follow these instructions to use this solution.

1. Add the Code to Outlook



Outlook 2000 - 2003.
1.      Start Outlook.
2.      Click ToolsMacroVisual Basic Editor.
3.      If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession.
4.      Copy the code below and paste it into the right-hand pane of Outlook's VB Editor window.
5.      Edit the code as needed.  I included comment lines wherever something needs to or can change.
6.      Click the diskette icon on the toolbar to save the changes.
7.      Close the VB Editor.
8.      Click ToolsMacroSecurity.
9.      Set the "Security Level" to Medium.
10.      Close Outlook
11.      Start Outlook
12.      Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Click Yes.

Outlook 2007.
1.      Start Outlook.
2.      Click ToolsMacroVisual Basic Editor.
3.      If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession.
4.      Copy the code below and paste it into the right-hand pane of Outlook's VB Editor window.
5.      Edit the code as needed.  I included comment lines wherever something needs to or can change.
6.      Click the diskette icon on the toolbar to save the changes.
7.      Close the VB Editor.
8.      Click ToolsTrust Center.
9.      Click Macro Security.
10.      Set "Macro Security" to Warnings for all macros.
11.      Click OK.
12.      Close Outlook
13.      Start Outlook.  Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Click Yes..

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    If Item.Subject = "" Then
        'Edit the message and the popup caption on the next line as desired.'
        msgbox "You are not allowed to send an item with a blank subject.  Please enter a subject and send again.", vbCritical + vbOKOnly, "Prevent Blank Subjects"
        Cancel = True
    End If
End Sub

Open in new window

2. Test the Solution


Create a test message and leave the subject blank.  Click Send.  Outlook should cancel the send and display a pop-up message that looks something like this.
Sample Blank Subject Warning Dialog-oxLinks to Other BlueDevilFan Articles

1. Creating Linked Notes in Outlook 2007
2. Extending Outlook Rules via Scripting
3. Importing and Exporting Outlook 2007 Categories
4. Outlook 2007 Corporate Categories System
5. Automatically Printing/Saving Emails/Attachments in Outlook
6. Never Again Forget to Add that Attachment to your Outlook Email
7. Enhancing Outlook 2007 Meeting Reminders
18
Comment
Author:David Lee
13 Comments
LVL 38

Expert Comment

by:younghv
Very nice work here - and a great way to stop that too common "Oops" feeling.

Thank you for putting this together - "Yes" vote above.
0

Expert Comment

by:goatbernard
this is really nice, thanks your effort!
0
LVL 76

Author Comment

by:David Lee
Thanks, guys.  Glad the tip was useful.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

LVL 10

Expert Comment

by:bromy2004
Just an FYI,
Outlook 2010 has this in by default.
Capture.JPG
0
LVL 50

Expert Comment

by:Dave
Thanks David :)
0
LVL 76

Author Comment

by:David Lee
You're welcome, Dave!
0
LVL 58

Expert Comment

by:tigermatt
Nice work BDF! Thanks.
0
LVL 76

Author Comment

by:David Lee
Thanks, tigermatt!
0
LVL 9

Expert Comment

by:Mohammad Ishtyaq khatri
Thanks, Very useful.
0

Expert Comment

by:fmcsa001
Boy I sure hope that you'll still see this since it was originally posted a year ago. My question is if there is a way to apply this macro to a remote computer w/out the user's knowledge? Perhaps with PowerShell?

I have a user that won't play nice and I would love to use this to force the issue but I assume that the user would need to be logged into so that it would be applied to his profile. Any suggestions?

0
LVL 76

Author Comment

by:David Lee
Yes, that's possible but it does entail some risk.  There is no truly automated way of deploying Outlook macro code.   The closest you can come is to deploy Outlook's code file.  Outlook stores all macro code in a single file.  If you overwrite that file with a file of your own, say one containing this code, then the next time the user starts Outlook this code will take effect.  The risk here is that if the user has some Outlook code already, then when you overwrite their file they'll lose everything they had.  If you're fairly certain that the user in question doesn't have any Outlook macro code, then you can do this safely.

One other point to consider.  Outlook security has to be set to allow the code to run.  Depending on what version of Outlook the user has you may be able to do that via a GPO too.  If not, then the code will either be blocked by Outlook's built-in security or, worse, the user will be prompted to enable the code which will tip them off to what you've done.

The file you would need to copy is VbaProject.OTM.  It's found in slightly different locations depending on the version of Windows being used.
0

Expert Comment

by:Neil Randall
Great tip and works for me . . . to a point.

Now if the user tries to send with no subject they hear the Windows Warning beep and the message box pops up . . . but behind the open mail! The user has to click back on the Outlook icon in the taskbar to see the message box, click ok and can then go back to the email.

Is there anyway of bringing the msgbox to the front?
0
LVL 76

Author Comment

by:David Lee
Hi, NELMO.

Glad you like the article.  Yes, that's possible.  Replace line #4 of the original code with this line

    MsgBox "You are not allowed to send an item with a blank subject.  Please enter a subject and send again.", vbCritical + vbOKOnly + vbApplicationModal, "Prevent Blank Subjects"

Open in new window

0

Featured Post

PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Join & Write a Comment

Discover the basics of using Outlook 2016 from office 365.
If you, like me, have a dislike for using Online Subscription anti-spam services, then this video series is for you. I have an inherent dislike of leaving decisions such as what is and what isn't spamming to other people or services for me and insis…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month