If you're constantly forgetting to fill in the subject field of your Microsoft Outlook emails, or you want to create a client-side provision that forces users to provide a subject lines for all company email messages, this tip offers a macro that solves that dilemma.
Courtesy of Outlook MVP Sue Mosher, the code snippet below intercepts any outgoing Microsoft Outlook email that does not have the Subject field filled in.
To create the macro in Outlook 2003, go to Tools -> Macro -> Visual Basic Editor (this feature has to be installed). In Microsoft Office Outlook Objects -> ThisOutlookSession, paste the following code:
If you already have code in the Application_Itemsend section, you can include this before or after it (probably afterward); just make sure there are no duplicate variable declarations or anything else that might interfere with it running.
About the author: Serdar Yegulalp is editor of the Windows Power Users Newsletter.
MEMBER FEEDBACK TO THIS TIP
Is ...
To continue reading for free, register below or login
To read more you must become a member of SearchExchange.com
');
// -->

there a code to automatically delete blank senders (i.e., blank From fields) in emails?
Neil P.
******************************************
According to Sue Mosher, the MVP from whom I derived the script, this is actually not possible unless you are in an Exchange environment and you create the email message in code by using an Outlook.MailItem object. In theory you can set the SendOnBehalfOfName property, but again, that only really works in Exchange environments.
I found a blog post that discusses this issue in some detail: Redemption still needed with Outlook VSTO 2005. I believe the Redemption toolkit for Outlook allows things like this to be done.
Serdar Yegulalp, tip author
******************************************
Thank you very much for this useful tip. I have a question: Does this macro function in Microsoft Outlook XP?
I use Microsoft Outlook XP SP 3. I followed the instructions but, unfortunately, the macro ran only the first time. When I closed the application and ran it again, the macro did not function.
Filip J.
******************************************
Unfortunately, I haven't tested the script in Microsoft Outlook XP. I would check to make sure you don't have macros persistently disabled in Outlook.
Serdar Yegulalp, tip author
******************************************
I'm using Microsoft Outlook 2003. This script worked the first time I tried it. But when I closed Microsoft Outlook and reopened it, the script did not work. Any ideas?"
Nikhil G.
******************************************
It sounds like you have scripting disabled by default whenever Microsoft Outlook is opened. You need to allow scripts to run in Microsoft Outlook to make this work consistently.
To enable scripting in Microsoft Outlook, go to the program's menu:
Tools -> Macro -> Macro Security. This will let you set the level of security for Microsoft Outlook macros, which are typically locked down pretty heavily by default.
Serdar Yegulalp, tip author
******************************************
I wanted to know how to install Visual Basic Editor for creating macros. I am presently using Microsoft Outlook 2007. Also, would this script run successfully on Microsoft Outlook 2007?
Arjun K.
******************************************
In Microsoft Outlook 2007, if you want to enable the Developer tab (which includes the Visual Basic macro editor), click on the Microsoft Office logo button when a message is open and select "Editor Options" at the bottom right corner. Under "Popular," select "Show the Developer tab in the ribbon." This enables access to the Office Visual Basic Editor.
Serdar Yegulalp, tip author
******************************************
How do we set permission for the scripts to execute in Microsoft Outlook 2007? This is similar to member Nikhil G.'s issue above. Thanks.
Edward A.
******************************************
Go to Tools -> Trust Center -> Macro Security and select "No security check for macros." Note that this assumes you have good control over what kinds of macros might be executed.
Serdar Yegulalp, tip author
******************************************
I used Sue Mosher's script to banish blank subject lines along with a related script that would check for attachments in the message body (and send a warning if no attachment is present). I put the attachment script first, and then the blank subject script follows. The first works, but the second does not. Any idea why this isn't working? These are, as you know, VB scripts in Microsoft Outlook.
(Click link to view the two subroutines that banish blank email subject lines and check for attachments.)
Steve R.
******************************************
I believe the second Sub should also be ItemSend (not Sending), so the two can actually be consolidated into a single subroutine.
Serdar Yegulalp, tip author
Do you have comments on this tip? Let us know.
Please let others know how useful this tip was via the rating scale below. Do you know a helpful Exchange Server, Microsoft Outlook or SharePoint tip, timesaver or workaround? Email the editors to talk about writing for SearchExchange.com.