Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing Outlook Email Templates 1

Status
Not open for further replies.

CWestII

Programmer
Jan 30, 2004
25
US
Good Afternoon All!

Let me preface this by saying that I know how to open Outlook templates via "Shell" commands And I know how to create new email objects and populate them using Outlook mail item objects from Access.

What I need to know is how can I populate an Outlook template (FileName.oft) using automation (e.g. Outlook mail item)from Microsoft Access.

Does anyone know how to do this?

I have looked at mail item objects and have not seen anything that looks like it would work.

Any help would be greatly appreciated!

Thanks in advance!
 
CWestII,
[tt]Outlook
[⌊]Application
[⌊]CreateItemFromTemplate(TemplatePath As String, [InFolder]) As Object[/tt]

CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
CautionMP, Thanks for the feedback. Do you have an example of how to use it? I have not used it before, so I am not familiar with what should go in the [InFolder] value.

If you could provide an example of this object in context it will be very helpful and greatly appreciated.

Thanks in advance!
 
MP,
I figured it out so I don't need the example now.

To all:
Here is what I did:

Dim olMailItem As Object
Dim strTemplPath As String
Dim myOlApp As Outlook.Application


strTemplPath = "TemplatePath\TemplateName.oft"
Set myOlApp = CreateObject("Outlook.Application")
Set olMailItem = myOlApp.CreateItemFromTemplate(strTemplPath)

'*************************************************'
TemplatePath and TemplateName are just place holders you must specify the actual Name and Path of the template.

After you set the olMailItem variable you can add all your other MailItem attributes (To, Subject, etc.)

I hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top