To create a new instance of a custom form programmatically, use the Add method on the target folder's Items collection:
Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")
If it's a message form, use the Drafts folder as the target. If the target is a default folder, you can use the Namespace.GetDefaultFolder method to return it as a MAPIFolder object. To create an item in another person's mailbox, use Namespace.GetSharedDefaultFolder to get the MAPIFolder Otherwise, you can use the code at
http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy and return the MAPIFolder corresponding to a given path string.
See
http://www.outlookcode.com/d/launchform.htm for other ideas.
Warning: YOu should not be using a published custom form for routine email messages to external recipients. An .oft file would be better in your scenario.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
"Lisab" wrote in message ...
Please Help!
I would like to know the VBA code to open and Outlook form I created that is
in the Personal Forms Library.
I am currently using Access to send E-mail to people that are stored in my
database. I am using the code found in here
http://support.microsoft.com/kb/209948/en-us
I think I have to change one of the following lines of code to something
else that refers to the form.
-------------
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
'Create from Template
Set MyItem = myOlApp.CreateItemFromTemplate("C:\filename.oft")
------------
PS. The form is just a basic form letter that does not have any fields.
There are graphics on the form and that is why I need to use it instead of
creating a new mail message.
Thanks