View Single Post
  #7  
Old April 21st 08, 02:23 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Button To Open Template - Outlook 2007

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/article.aspx?id=56 for other ideas.

BTW, using a published custom form to send messages outside an Exchange organization can cause problems with attachments for the recipients.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"PeterHS" wrote in message ...
Is this also possible to do this with forms i published? The last 4 hours I
tried to put "olformregistry" and "olorganizationregistry" in the command,
but I can't get it to work.

Or as a alternative to open the dialog with standard the public forms?

Or are i'm searching for something that is imposible. What I want is for
users to "with one button to choose from I list off published forms for
sending e-mail".

Manny thanks

Peter



"Sue Mosher [MVP-Outlook]" wrote:

Write a macro that calls the Application.CreateItemFromTemplate method:

Sub MakeItem()
Set newItem = Application.CreateItemFromTemplate("c:\your path\open test.oft")
newItem.Display
Set newItem = Nothing
End Sub

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"garfong" wrote in message ...
I need to create a button on the toolbar that will open a template stored in
the office\templates directory. I tried creating a button that hyperlinked to
the template but Outlook has decided such a move is dangerous and once the
user gets past all the warnings, the template comes up blank because outlook
has blocked all the functionality.

Any ideas how I can use VBA to get past the annoying prompts and get the
button to open the template directly? In effect, the button would recreate
the steps of going to File New Choose Form Look In: User Templates In
File System Open test.otf


Ads