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
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...
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...
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
"Bernie Deitrick" <dei...@consumer.org> wrote in message
news:exegGS1fCHA.1256@tkmsftngp10...
Greg
"Bernie Deitrick" <dei...@consumer.org> wrote in message
news:exegGS1fCHA.1256@tkmsftngp10...