Home > Microsoft Exchange Tips > Outlook and Outlook Web Access Tips > Microsoft Outlook script: Banish blank email subject lines
Exchange Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

Microsoft Outlook script: Banish blank email subject lines


Serdar Yegulalp
Rating: -5.00- (out of 5)

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 ...


RELATED CONTENT
Outlook and Outlook Web Access Tips
What's new in Microsoft Outlook 2010?
How to create multiple instances of OWA
Top 5 OWA tips of 2009
Top 5 Microsoft Outlook tips of 2009
How mailbox rules and Windows Desktop Search affect Outlook 2007
Predict how large Outlook 2007 mailboxes will perform
Effects of excessive mailbox size and storage on Outlook performance
Block Web beacons and protect OWA users from spam
Outlook 2007 shut-down problems and fixes
OWA 2007 configuration tricks to boost performance

Microsoft Outlook
What's new in Microsoft Outlook 2010?
Top 5 Exchange mobile tips of 2009
How to create multiple instances of OWA
Exporting Exchange Server mailbox messages into .pst files
Microsoft Outlook mailbox is not shrinking as expected
Creating an active GAL on Outlook 2003 and 2007
Top 5 Microsoft Outlook tips of 2009
How mailbox rules and Windows Desktop Search affect Outlook 2007
Error message appearing after user has been deleted in Outlook 2003
Creating an Outlook 2007 user profile in Windows Vista
Microsoft Outlook Research

Microsoft Exchange Server Scripts and Programming
Removing old disclaimers from Exchange Server 2003
How to run Exchange Management Shell cmdlets in Exchange Server 2007
Automate complex Exchange 2007 Management Shell tasks via scripting
Exchange event sink scripting error when configuring email disclaimer
EMS add-on tool generates graphical Exchange Server 2007 reports
A primer on the Exchange Server 2007 Exchange Management Shell
How to generate HTML reports with the Exchange Management Shell (EMS)
Use the Exchange Management Shell Set command to block senders
How to test Exchange Management Shell commands
Grant or deny permissions to access a user's Exchange 2007 mailbox

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
bacn  (SearchExchange.com)
email bankruptcy  (SearchExchange.com)
offline folder file  (SearchExchange.com)
OST file  (SearchExchange.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


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.

Rate this Tip
To rate tips, you must be a member of SearchExchange.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Email Server Solutions: Exchange 2007, Exchange 2003, Exchange 2000, SharePoint
HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2004 - 2010, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts