Can you populate an outlook Form or Template from Access or Word?

G

GrannyM

I'm using Outlook 2000 and our System Administrator does not allow us to turn
on the feature to use Microsoft Word to edit emails.

What I would like to do is let a user click on a button in Access and it
would open an Outlook template or form, populate the appropriate fields using
information from the database, then send the email. I have been able to
create and send a plain text email, or send a template or form with blank
fields. I even tried to create a form in Word then insert the form into the
email, similar to Insert > Object > create from file, but couldn't figure out
how to do that either.

Could someone please let me know first of all, is this even possible or am I
just spinning my wheels here. And if it is possible, where do I start? I've
never programmed in Outlook, but I have used redemption to create and send
plain text emails.

Any help or advice is appreciated.

Thanks
 
E

Eric Legault [MVP - Outlook]

If this is a custom form you need to create it by getting the Items object
from the Folder where the form is published (or any folder if it's a form
that's globally published to the Organization Forms Library).

For instance:

Dim objFolder As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Dim objItems As Outlook.Items
Dim objNewMail As Outlook.MailItem
Dim objUPS As Outlook.UserProperties
Dim objUP As Outlook.UserProperty

Set objNS = Outlook.GetNamespace("MAPI")
Set objFolder = objNS.GetDefaultFolder(olFolderInbox)
Set objItems = objFolder.Items
Set objNewMail = objFolder.Items.Add("IPM.Note.MyCustomMailForm")

objNewMail.Subject = "Send Me"
objNewMail.To = "(e-mail address removed)"
Set objUPS = objNewMail.UserProperties
Set objUP = objUPS.Item("CustomField1")
objUP.Value = "My Value"
objNewMail.Send

The UserProperties collection corresponds to the custom fields that you have
bound to the controls on the form.

--
Eric Legault [MVP - Outlook]
MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007
& WSS 3.0 Application Development)
President
Collaborative Innovations
-> Try Picture Attachments Wizard 2.0 For Microsoft Outlook <-
-> Take your SharePoint content offline <-
-> More info: http://www.collaborativeinnovations.ca <-
Blog: http://blogs.officezealot.com/legault
 
G

GrannyM

Thank you! Thank you! Thank you! I have struggled with this for days, but
since I wasn't even sure it could be done, I was getting very frustrated. I
poured over 2 different Outlook books and 3 help sites but wasn't getting
anywhere. I had part of what you have below, but not all the pieces.

I have asked my manager to order Sue Mosher's Microsoft Outlook Programming.
Do you have any other references to recommend?

Eric Legault said:
If this is a custom form you need to create it by getting the Items object
from the Folder where the form is published (or any folder if it's a form
that's globally published to the Organization Forms Library).

For instance:

Dim objFolder As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Dim objItems As Outlook.Items
Dim objNewMail As Outlook.MailItem
Dim objUPS As Outlook.UserProperties
Dim objUP As Outlook.UserProperty

Set objNS = Outlook.GetNamespace("MAPI")
Set objFolder = objNS.GetDefaultFolder(olFolderInbox)
Set objItems = objFolder.Items
Set objNewMail = objFolder.Items.Add("IPM.Note.MyCustomMailForm")

objNewMail.Subject = "Send Me"
objNewMail.To = "(e-mail address removed)"
Set objUPS = objNewMail.UserProperties
Set objUP = objUPS.Item("CustomField1")
objUP.Value = "My Value"
objNewMail.Send

The UserProperties collection corresponds to the custom fields that you have
bound to the controls on the form.

--
Eric Legault [MVP - Outlook]
MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007
& WSS 3.0 Application Development)
President
Collaborative Innovations
-> Try Picture Attachments Wizard 2.0 For Microsoft Outlook <-
-> Take your SharePoint content offline <-
-> More info: http://www.collaborativeinnovations.ca <-
Blog: http://blogs.officezealot.com/legault


GrannyM said:
I'm using Outlook 2000 and our System Administrator does not allow us to
turn
on the feature to use Microsoft Word to edit emails.

What I would like to do is let a user click on a button in Access and it
would open an Outlook template or form, populate the appropriate fields
using
information from the database, then send the email. I have been able to
create and send a plain text email, or send a template or form with blank
fields. I even tried to create a form in Word then insert the form into
the
email, similar to Insert > Object > create from file, but couldn't figure
out
how to do that either.

Could someone please let me know first of all, is this even possible or am
I
just spinning my wheels here. And if it is possible, where do I start?
I've
never programmed in Outlook, but I have used redemption to create and send
plain text emails.

Any help or advice is appreciated.

Thanks
 

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