Sign in
KC Lemson
By KC Lemson [MS]
Options
Blog Home
Share this
RSS for posts
Atom
RSS for comments
Search Blogs
Tags
100 Things About Me
Community
End User
Excel Tips
Exchange
Health
History
Microsoft
Misc Fun
Misc Tips
Office Tips
Outlook
Outlook VBA
Pages
Personal
Photography
Program Management
Release Management
Software Development
User Experience (UX)
Word Tips
Archive
Archives
May 2012
(3)
June 2011
(1)
February 2010
(2)
October 2009
(1)
May 2009
(1)
April 2009
(2)
March 2009
(1)
November 2008
(4)
October 2008
(3)
September 2008
(4)
August 2008
(2)
July 2008
(5)
June 2008
(5)
May 2008
(6)
April 2008
(5)
March 2008
(2)
February 2008
(6)
January 2008
(7)
December 2007
(5)
November 2007
(2)
October 2007
(1)
August 2007
(6)
July 2007
(3)
June 2007
(8)
May 2007
(4)
April 2007
(1)
January 2007
(5)
December 2006
(5)
October 2006
(5)
September 2006
(8)
August 2006
(3)
July 2006
(1)
June 2006
(4)
May 2006
(3)
April 2006
(2)
March 2006
(2)
February 2006
(3)
January 2006
(4)
December 2005
(4)
November 2005
(1)
October 2005
(4)
September 2005
(1)
August 2005
(6)
July 2005
(1)
June 2005
(7)
May 2005
(3)
April 2005
(3)
March 2005
(2)
February 2005
(1)
January 2005
(3)
December 2004
(7)
November 2004
(8)
October 2004
(5)
September 2004
(10)
August 2004
(10)
July 2004
(23)
June 2004
(32)
May 2004
(19)
April 2004
(38)
March 2004
(42)
February 2004
(33)
January 2004
(44)
December 2003
(24)
November 2003
(22)
October 2003
(27)
September 2003
(9)
A poor man's mail merge
TechNet Blogs
>
KC Lemson
>
A poor man's mail merge
A poor man's mail merge
Rate This
KC Lemson [MSFT]
2 May 2005 11:50 PM
Comments
5
Several times in the last few months I've needed to send the exact same mail content to a list of people, but each mail had to be separately addressed, for the following reasons:
I am expecting each recipient to reply and continue the thread with me. This way there's no risk of "Reply All" going to anyone other than me.
To gain the psychological benefit of "Oh, the message is sent only to me, so I should probably respond." I find that when I email something to multiple people, in some cases people will assume that since there are several people on the receiving end, someone else will handle it, or they can at least push off reading it until later.
In each case, the content of the mail was a one-time thing, i.e. I needed to send this one mail to five people today, and then next week I might have another email to send to six people, but that would be a different email. So in my case, it didn't really make sense to create an email template. I also didn't want to use Word and do an official mail merge because I wanted a quick and dirty way to save time, and I didn't want to step through the 6 page mail merge wizard where you select the document, the contacts folder, etc etc.
So, I wrote a macro. It's pretty durn rough around the edges (I'd be embarrassed to put this next to any of the samples on
http://www.outlookcode.com
, but hey, it works for me :-), but it works so I thought I'd share it. First off, if you're not familiar with running macros in Outlook see
my posts about VBA
to learn the basics. The way this macro works is:
#1: Create the message you want to create a template out of (i.e. enter the subject and body). In the To field, put the list of people to which you want to send individual emails.
#2: Save this item to your drafts folder
#3: Run the macro (
assigning it to a button
will make this easier)
#4: It will pop up the messages in front of you. Hit Alt+S to send each of them in turn.
Here's the code:
Public Sub KCsCheapoMailMerge()
Dim outapp As Outlook.Application
Dim olExp As Outlook.Explorer
Dim olItemTemplate As Outlook.MailItem
Dim olItem As Outlook.MailItem
Dim arrAddresses() As String
Dim strAddresses As String
Dim i As Integer
Set outapp = CreateObject("Outlook.application")
Set olExp = outapp.ActiveExplorer
Set olItemTemplate = olExp.Selection.Item(1)
strAddresses = olItemTemplate.To
arrAddresses = Split(strAddresses, ";")
For i = 0 To UBound(arrAddresses)
Set olItem = outapp.CreateItem(olMailItem)
olItem.Subject = olItemTemplate.Subject
olItem.Body = olItemTemplate.Body
olItem.To = arrAddresses(i)
olItem.Recipients.ResolveAll
olItem.Display
Next
End Sub
See? I told you it was cheap and rough around the edges. And I never destroy my objects in my macros, too lazy and plus it just seems cruel, they barely had a chance at existing! Some minutae:
Since you're programatically accessing fields on a message that could contain recipient info, you'll get the popup to allow it. That's the price you pay for quick and dirty macros rather than fancy com add-ins :-)
I didn't do automatic sending of the messages because it'll hit the object model block which makes you wait five seconds per message and the entire point of this was to be quick. Also, I'm a perfectionist (funny, given my laziness around destroying objects...) and it gives me a chance to do a last minute once-over of the messages and recipients to make sure everything's as I expected it.
5 Comments
Outlook
,
Outlook VBA
,
Office Tips
,
End User
Comments
Comments
Loading...