PC Review


Reply
Thread Tools Rate Thread

DoCmd.SendObject TemplateFile

 
 
Chris
Guest
Posts: n/a
 
      7th Apr 2010
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?
 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      8th Apr 2010
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" wrote:

> 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?

 
Reply With Quote
 
Chris
Guest
Posts: n/a
 
      8th Apr 2010
The code came from Arvin Meyer at
http://www.datastrat.com/Code/OutlookEmail.txt

"Chris" wrote:

> 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" wrote:
>
> > 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?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SendObject Question Concerning TemplateFile Don Microsoft Access VBA Modules 0 24th Apr 2009 03:08 PM
Using DoCmd.SendObject CJA Microsoft Access Form Coding 1 13th Mar 2008 01:36 AM
SendObject - TemplateFile AND "White Space in MessageText ant1983 Microsoft Access VBA Modules 3 6th Feb 2008 08:08 PM
TemplateFile Argument in SendObject =?Utf-8?B?U3R1Sm9s?= Microsoft Access VBA Modules 0 24th May 2006 08:47 PM
Re: DoCmd SendObject Alex Dybenko Microsoft Access VBA Modules 1 2nd Aug 2004 07:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:53 PM.