email a word document from an ms-access application

G

Guest

I wish to be able to email a word document automatically from an access
application. Is it possible to due this without entering the email address
and recipients details into Outlook Express first? I hold the recipients
name and email address in my access database.
 
G

Guest

Yes:

Private Sub Command5_Click()
DoCmd.OutputTo acOutputReport, "NameOfAccessReport", acFormatRTF,
"FullNameAndPathOfOutputFile"

Dim wdApp As Word.Application
Dim doc As Word.Document

Set wdApp = New Word.Application
Set doc = wdApp.Documents.Open("FullNameAndPathOfOutputFile")
wdApp.Run "NameOfMacro"
wdApp.Quit False
Set doc = Nothing
Set wdApp = Nothing

Kill ("FullNameAndPathOfOutputFile")

End Sub

Sub NameOfMacro()

Set Report = ActiveDocument.MailEnvelope.Item
Report.To = "RecipientEmailAddress"
Report.Subject = "WhatEverYouWant"
Report.Send
End Sub


Place the name of your textbopx holding the email address in the mail
recipient line
 
G

Guest

Jeff C Thanks for your help, however I have a problem whereby you refer to
"NameOfAccessReport". I have no report specified, only the Path & Name of the
Word Document I want to send. I must be missing something in your thinking -
sorry to be a pain
 
G

Guest

Jeff C Thanks for your help, however I have a problem whereby you refer to
"NameOfAccessReport". I have no report specified, only the Path & Name of the
Word Document I want to send. I must be missing something in your thinking -
sorry to be a pain
 

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