Code-How to open an Outlook Form stored in the Personal Forms Libr

G

Guest

I have a form that I created in Outlook located in the Personal Forms
Library. It is a simple form letter that gets mailed to many people on a
regular basis. I need to know how to set up the code so that form gets
opened when I use automation to send email through Access 2000.

I am using the How to uses Automation to send outlook messages code found in
http://support.microsoft.com/kb/209948/en-us

I can't figure out how to reference the form I created. It is in the
Personal Forms Library and it's called Prevalence Report. I found out how to
open a template using the follwoing code. However I cannot find/figure out
how to open my outlook Form?

Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

'Create from Template
Set MyItem = myOlApp.CreateItemFromTemplate("C:\filename.oft")

Please HELP! Thanks.
 
G

Guest

OK. I figured it out. I was able to create an Outlook template (.oft file)
and I
changed my code in Access to this:
------------------------
Public Function SendEMail(RecipientTo As String)

Dim objOutlook As Outlook.Application
Dim objOutlookRecip As Outlook.Recipient
Dim MyItem As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.Application")
Set MyItem = objOutlook.CreateItemFromTemplate("C:\pathtofilename.oft")

With MyItem

Set objOutlookRecip = .Recipients.Add(RecipientTo)
objOutlookRecip.Type = olTo

..Subject = "My Subject"

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next

..Display

End With
Set objOutlook = Nothing
End Function
 

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