Automation

W

Wendy

I have successfully sent a current record from an Access
form into a Word 2000 template...and printed. I would now
like to email the same word document from access...is
this possible? Thank you.
 
A

Alastair MacFarlane

Yes, this is possible. You would save the word document
using the document object of the documents collection and
then use the following code (making sure you have a
refence to outlook in your access database):

Public Sub SendDOCFile()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add
("(e-mail address removed)")
objOutlookRecip.Type = olTo
.Subject = "Important Information"
.Importance = olImportanceHigh
.HTMLBody = "Hello"
Set objOutlookAttach = .Attachments.Add("c:\word.doc")
.Send
End With
exitsub:
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookAttach = Nothing
Exit Sub
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top