DoCmd.SendObject TemplateFile

C

Chris

I am trying to send an email using an Outlook Template. My code line is:

DoCmd.SendObject acSendNoObject, , , [Name (Last, First)], , , , , True,
"<Network Path>\Home\Templates\PRC Equipment Request Confirmation.oft"

The code will open the email which I want but it is a blank email and not
the template. The template is a HTML format but that should not matter when
calling the template.

How do I get Access to open the template file?
 
C

Chris

The Solution is:
Dim objOutlook As Object
Dim objEmail As Object
Set objOutlook = CreateObject("Outlook.application")
UserName = Name Field
SubjectText = "Subject Text"
EmailTemplate = "C:\Users\Me\Templates\Test.Oft"
Set objEmail = objOutlook.CreateItemFromTemplate(EmailTemplate)
With objEmail
.To = UserName
.Subject = SubectText
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Test.htm"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Display
'.Send - this didn't work on my setup but .Display did
'.ReadReceiptRequested

End With
 
C

Chris

The code came from Arvin Meyer at
http://www.datastrat.com/Code/OutlookEmail.txt

Chris said:
The Solution is:
Dim objOutlook As Object
Dim objEmail As Object
Set objOutlook = CreateObject("Outlook.application")
UserName = Name Field
SubjectText = "Subject Text"
EmailTemplate = "C:\Users\Me\Templates\Test.Oft"
Set objEmail = objOutlook.CreateItemFromTemplate(EmailTemplate)
With objEmail
.To = UserName
.Subject = SubectText
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Test.htm"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Display
'.Send - this didn't work on my setup but .Display did
'.ReadReceiptRequested

End With
Chris said:
I am trying to send an email using an Outlook Template. My code line is:

DoCmd.SendObject acSendNoObject, , , [Name (Last, First)], , , , , True,
"<Network Path>\Home\Templates\PRC Equipment Request Confirmation.oft"

The code will open the email which I want but it is a blank email and not
the template. The template is a HTML format but that should not matter when
calling the template.

How do I get Access to open the template file?
 

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