Send email contacts to access db

  • Thread starter Thread starter TLMM
  • Start date Start date
T

TLMM

Hi,

I am wondering how to send an email to a list of people in an Access
database. The email should have a message in the body, as well as a Word
attachment.

I know how to do this using a mail merge in Word where I can send the email
using the Word doc as the email body message or attach this Word doc to the
email, and I can select the recipients from an Access db. I want to be able
to do both - have a message in the body of the email and attach a Word doc.
I don't see an option to do this when doing a mail merge in Word using an
access db.

Is there a way I can do this?

Thanks!
 
TLMM said:
Hi,

I am wondering how to send an email to a list of people in an Access
database. The email should have a message in the body, as well as a
Word attachment.

I know how to do this using a mail merge in Word where I can send the
email using the Word doc as the email body message or attach this
Word doc to the email, and I can select the recipients from an Access
db. I want to be able to do both - have a message in the body of the
email and attach a Word doc. I don't see an option to do this when
doing a mail merge in Word using an access db.

Is there a way I can do this?

Thanks!


Here is some VBA code I probably picked up in this newsgroup, written
by Arvin Meyer:

Private Sub Command1_Click()
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = "(e-mail address removed)"
.Subject = "Look at this sample attachment"
.Body = "'Tis a good attachment."
.Attachments.Add "C:\Test.doc"
'.Attachments.Add "C:\Test.txt"
.Send
'.ReadReceiptRequested
End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

End Sub


I have tried this, and it worked fine for me.


Matt
 
Thanks. I was hoping there would be a way to do this without having to
write code. It is very simple to do a mail merge in word using the contacts
in an access db without writing code, but I can't seem to figure out how to
send my attachment and also write a message in the body of the email. I
don't know if it's possible or not??? If I can't figure out how to do it
without code, then I will try the code you sent me. Do you know how I would
change the code to send to all the contacts in a db instead of just to one
email address?

Thanks again!
 
TLMM said:
Thanks. I was hoping there would be a way to do this without having
to write code. It is very simple to do a mail merge in word using
the contacts in an access db without writing code, but I can't seem
to figure out how to send my attachment and also write a message in
the body of the email. I don't know if it's possible or not??? If I
can't figure out how to do it without code, then I will try the code
you sent me. Do you know how I would change the code to send to all
the contacts in a db instead of just to one email address?

Thanks again!


I have looked and cannot find any way to add attachments through the
Word mail merge. I tried accessing the mail merge object in VBA as
well, and the option simply seems not to be there. The code I pasted
to you does not use Word; it opens Outlook directly. I have not done
much work with this method, so I have not found a way to add a list of
e-mail addresses. It was my hope that someone else with more coding
knowledge would be able to pitch in.

Sorry.


Matt
 
Back
Top