Code Sample
This VBA subroutine to
open a new item based on a customized Task form, published as
IPM.Task.MyForm, is adapted straight from the Help file. Note the
use of the MAPIFolder.Items.ItemAdd method
instead of Application.CreateItem to create
the task using a custom form.
If you're using some other type of form
besides a Task form, make sure that the
argument for GetDefaultFolder() specifies
the right folder for the type of item you're
trying to create. The Auto List Members
feature of VBA will suggest constants for
Outlook's default folders.
If you want to have the item saved to a
particular folder, get the appropriate
MAPIFolder object by the usual means (PickFolder
method, walking the folder tree,
GetFolder() function,
etc.) and use the Add method on its Items
collection.
You can also adapt the above code to
VBScript in a web page by using late
binding, rather than specific Dim type
declarations, and substituting the numeric
literal values for constants like
olFolderTasks.
|