Use An Outlook Macro To Stop Forgetting The Subject Line
Windows only: Microsoft Outlook is a powerful tool —and with a little macro goodness, it will remind you to attach a subject line to your TPS Reports.
Adding the new macro requires a number of steps, but when you are finished you’ll have a reminder to add in a subject line—just like Gmail has by default. You’ll need to open up the Visual Basic macro editor, find ThisOutlookSession over in the left-hand treeview, and then paste in the macro into the editor.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
DimstrSubjectAsString
strSubject=Item.Subject
IfLen(Trim(strSubject))=0Then
Prompt$=”SubjectisEmpty.AreyousureyouwanttosendtheMail?”
IfMsgBox(Prompt$,vbYesNo+vbQuestion+_
vbMsgBoxSetForeground,”CheckforSubject”)=vbNoThen
Cancel=True
EndIf
EndIf
End Sub
Once you’ve saved and closed the macro editor, you should receive a warning anytime you forget the subject line—a very useful trick to avoid sending an unfinished email.
Hit the link for the detailed walk-through screenshot tour. Note: this macro was found on at least half a dozen web sites, so we’re not really sure who the original author is, but the CodeProject link explains the process in the most user-friendly way. For more, check out how to defer sending emails to avoid embarrassment, or take a look through our top 10 Outlook boosters.
Blank Subject Warning for Outlook 2007 [CodeProject]
- Next Post: Match Your Learning Style With The Proper Productivity Tools »
- « Previous Post: Deter Thieves By Uglifying Your Camera
Comments (AU Comments | US Comments)
Has anyone ever seen a Outlook Macro that would warn you about sending an email to someone from a different account than you normally do?
I have several accounts that I manage and occasionally forget to switch from the default account to one I normally use with a particular client.
@wickedcupofjoe: Awesome... good to hear. You're on your way to VB programming.
TheOtherHalf
For what it's worth, here is a macro I created that checks subject lines, blank locations in meeting invites, and missing attachments. It was based on some previous code that was linked here on Lifehacker, plus some code from Sue Mosher's wonderful Outlookcode.com website. Here is the link:
[manage-this.com]
@TheOtherHalf: Yes that did it! :) I had to add it before the 'end sub' and then it worked. Thanks for helping - that's two of the most common things I forget - subject and attachment. :|
Can we have one that smacks people in the face when they type up their email in a Word Doc, then attach the Word doc to an email and send it out with a note saying "please read the attached document"?
TheOtherHalf
@wickedcupofjoe: can you place
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
below your attachment reminder code? I'm pretty sure you can only have one Application_ItemSend sub in there at a time, but you can put as much code as you want in there.
HTH
TheOtherHalf
@AnonJr: I confirmed that this works in Outlook 2003.
CONFIRMED: This works in Outlook 2003. The only difference in the instructions is the security part. There is no "Trust Center" in 2003, but I have mine set to medium if that makes any difference.
I want the opposite. I hate programs that tell me I must have a subject line. It drives me nuts in gmail. Sure, subjects are good for business email, but I don't need one when I email my wife, and I hate it nagging me for one.
knoxjon
nice, this will come in handy
masBoi
I can't get it to work due to another script I have in there. I'm not good with the editor - can I change the name (both scripts are using Private Sub Application_ItemSend) or do something else to utilize it? I have an attachment reminder in there already.
@AnonJr: I would think so, but since I don't have an earlier version to test with, I'm not sure!
If you do test it out, let us know if it works for you.
Does this work in earlier versions too? That would be a blessing where I work...
AnonJr
We're all human. But if you repeatedly make this mistake, you deserve to look like the rocket scientist you are.
SloYerRoll
@mgpcoe: I agree... Not to mention that certain tools like ClearContext depend on the subject line to keep track of topics/threads and projects. Messages with blank subjects don't get fully processed.
Oh my good good God, I would /love/ for a few certain people at my office to have this macro. I'm good about remembering my Subject lines (and thanks to a previous Outlook hack here on lh, a lot better about remembering the attachment), but it's an immense PITA to try to find a specific, un-Subjected email from a person when Outlook gathers all the subjects together under Conversation view.
mgpcoe
@TheOtherHalf: You win the award for having the most incompetent email correspondents *EVER*. Period. End of story!
Call me lucky, but I haven't seen that level of incompetence in my inbox yet...
@gkhairallah: In OL2003 you can just click the subject in the open message window and start typing, no menus required. Not sure if this works in OL2007. Of course, I have enough to do without categorizing other people's messages for them. If senders would be kind enough to add descriptive subjects in the first place, there would be no need (hence the macro).
Maybe what I need is another macro the checks incoming messages and when appropriate sends an automatic reply, "Your messages was automatically deleted because it had no subject line. Please try re-sending." :-)
@carl_c: Just as an FYI, I deal with this a lot... and sometimes even if there is a subject, it's not very descriptive of the topic. When you have a received message in your inbox, you can double click on it, then go to Other Actions / Edit Message (in outlook 2007) or (Tools / Edit Message (In Outlook 2003), and it will allow you to edit / Annotate any email that you receive, and save it.
In your case, you can just add a subject line to the email that would be relevant to its contents. :)
Nicely altered for that combo punch of the Attachment and Subject reminder. Nice work you two!
Aaron Smethurst
Wrote a similar VBA script that kept me from sending an email without a file. It searched the text for the words "file" or "attached," and, if found, asked me if I'd meant to attach a file. The script should work for any Outlook from 2000 on. Microsoft keeps making noise about eliminating Visual Basic for Applications, but they have yet to carry out their threats. (Office 2010?)
ZanebonoAntimachus
@carl_c: Oh, that's cool. Thanks for the tip Carl! For some reason I had never tried to edit the subject line of an open message without going to the menu. I wish you were able to edit the body of the message the same way you do the subject in that manner but it's no big deal, still pretty useful that way :)
btw, tried it in OL2007 and it still works that way.
@cha0tic: Sadly for us, we need earlier... but I'll try this anyway.
AnonJr
Funny...one of my earliest comments on this site was a note that I wrote a macro that does this. I guess I need to be more pushy to make it to the front page :P