Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using Excel data to do a mail merge in Outlook?

31 views
Skip to first unread message

Steve

unread,
Oct 28, 2002, 7:58:48 PM10/28/02
to
Using Office 2000. Have a database in Excel of approx 180
entries. Each entry has company, saluation, first name,
last name, phone and e-mail. I'd like to write one HTML e-
mail and personalize it for all 180 entries.

How do I automate the process such that an e-mail is
written in Outlook with instructions get the data (e-mail
address, name, etc) directly from an Excel file??

If this is not possible in one step, can this be
accomplished more easily if I first import the data into
Outlook? Alternately, do I write the e-mail in Word and
then do a merge with Excel?

In other words, how do I create an e-mail merge (like a
standard mail merge in word?

Please respond online or offline.

thanx,

Steve

Bernie Deitrick

unread,
Oct 29, 2002, 9:08:53 AM10/29/02
to
Steve,

The way I did this was to use Excel to automate Outlook. Set a reference to
Outlook in your Excel VBA project, then name the range with the 180 Email
addresses "EMailAddresses". Copy their first names into the column next to
the email addresses (or change the 1 in AddCell.Offset(0, 1) to select their
first names) and use offsets to get the rest of the info that you need.
Test is first with your own address so that you can see what the message
looks like and that you are properly selecting the correct fields.

HTH,
Bernie

Sub EmailRecipient()
Dim ol As Object
Dim myItem As Object
Dim AddCell As Range

Set ol = CreateObject("outlook.application")
For Each AddCell In Range("EMailAddresses")
Set myItem = ol.CreateItem(olMailItem)
myItem.To = AddCell.Value

myItem.Subject = "Automatic message generation...."

myItem.Body = "Hello " & AddCell.Offset(0, 1).Value & _
Chr(13) & Chr(13)
myItem.Body = myItem.Body & "Thanks for being you. " & _
Chr(13) & Chr(13)
myItem.Body = myItem.Body & "Your Friend Steve" & Chr(13)
myItem.Send
Next AddCell

Set ol = Nothing
End Sub

"Steve" <stev...@cyberstuff.net> wrote in message
news:a7b101c27ee6$56f2dd50$39ef2ecf@TKMSFTNGXA08...

Bernie Deitrick

unread,
Oct 29, 2002, 1:44:49 PM10/29/02
to
Greg,

Add this stuff, for example

Dim myAttachments As Attachments
Set myAttachments = myItem.Attachments
myAttachments.Add "C:\excel\time\time sheet.xls", olByValue

HTH,
Bernie

"Greg Rivet" <greg...@hotmail.com> wrote in message
news:O0dsCJ3fCHA.2392@tkmsftngp08...
> Bernie, how do you modify this code to add an attachment. TIA
>
> Greg
> "Bernie Deitrick" <dei...@consumer.org> wrote in message
> news:exegGS1fCHA.1256@tkmsftngp10...

Bernie Deitrick

unread,
Oct 29, 2002, 1:46:11 PM10/29/02
to
Greg,

Change

For Each AddCell In Range("EMailAddresses")

to

For Each AddCell In Selection

to select the address cells to which to send mail.

HTH,
Bernie


"Greg Rivet" <greg...@hotmail.com> wrote in message

news:O#PLPL3fCHA.1768@tkmsftngp11...
> Bernie, one more thing, what if I only want to send the message to a
> selection within my Email addresses. TIA


>
> Greg
> "Bernie Deitrick" <dei...@consumer.org> wrote in message
> news:exegGS1fCHA.1256@tkmsftngp10...

Greg Rivet

unread,
Oct 29, 2002, 12:40:11 PM10/29/02
to
Bernie, how do you modify this code to add an attachment. TIA

Greg
"Bernie Deitrick" <dei...@consumer.org> wrote in message
news:exegGS1fCHA.1256@tkmsftngp10...

Greg Rivet

unread,
Oct 29, 2002, 12:44:09 PM10/29/02
to
Bernie, one more thing, what if I only want to send the message to a
selection within my Email addresses. TIA

Greg
"Bernie Deitrick" <dei...@consumer.org> wrote in message
news:exegGS1fCHA.1256@tkmsftngp10...

0 new messages