Application.CreateItemFromTemplate Method
Outlook Developer Reference |
Creates a new Microsoft Outlook item from an Outlook template (.oft) and returns the new item.
Syntax
expression.CreateItemFromTemplate(TemplatePath, InFolder)
expression A variable that represents an Application object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
TemplatePath | Required | String | The path and file name of the Outlook template for the new item. |
InFolder | Optional | Variant | The folder in which the item is to be created. If this argument is omitted, the default folder for the item type will be used. |
Return Value
An Object value that represents the new Microsoft Outlook item.
Remarks
New items will always open in compose mode, as opposed to read mode, regardless of the mode in which the items were saved to disk.
Example
This Visual Basic for Applications (VBA) example uses CreateItemFromTemplate to create a new item from an Outlook template and then displays it. The CreateTemplate macro shows you how to create the template that is used in the first example. To avoid errors, replace 'Dan Wilson' with a valid name in your address book.
Visual Basic for Applications |
---|
|
The following Visual Basic for Applications (VBA) example shows how to use the optional
InFolder
parameter when calling the CreateItemFromTemplate method.
Visual Basic for Applications |
---|
|
See Also