Tony Zhang

专注于Exchange,Outlook管理以及相关编程

导航

[转]To launch a custom Outlook form

Posted on 2008-03-03 10:44  Tony Zhang  阅读(637)  评论(0编辑  收藏  举报

Once you develop and publish a custom form, what's the best way to make it easy to launch? Probably the least convenient method is to require the user to go through the Tools | Forms | Choose Form dialog. Here are some alternatives, including third-party tools.

From a folder

If you publish a custom form to a folder, you can launch the form from the command that appears at the bottom of the folder's Action menu. 

For a Appointment, Contact, Journal, Task or Post form, you can make the custom form the default for a folder on the folder's Properties menu. The default  form launches when the user presses Ctrl+N or double-clicks in the folder view.

You cannot make a message form the default for a folder, because messages are designed to be sent, not posted. The workaround is to make a post form the default, and use this code on the post form to launch your custom message form:

We also have a custom Form Launcher form that provides this capability. See OL2000 How to Set Any Form as Default for a Folder for more on this issue. Message forms need additional special treatment, because message items always save in Drafts; see Microsoft Outlook Message Forms.

From a Windows shortcut

The syntax for launching a published custom form from a Windows shortcut is very simple:

"<path>\Outlook.exe" /c "IPM.Note.My Form"

where <path> represents the full path to your Outlook.exe file. (HINT: Use Start | Find to locate Outlook.exe, then drag it to the Windows desktop to create a shortcut. You can then modify this shortcut to add the /cswitch and published form name.

If you didn't publish the form, but instead saved it as an .oft Outlook template file, you can launch it from a shortcut to the .oft file only if the form contains no customized pages or custom fields. In other words, launching an .oft file from a shortcut works only if the "form" is a simple copy of the standard form with the item body or key property values set. To launch any more complex .oft file, you must use the Tools | Forms | Choose Form command and browse to the file location.

From a hyperlink

Outlook 2003 allows you to create toolbar buttons as hyperlinks to Web URLs, but also to any system files, including an Outlook form, saved as a file:

  1. Choose File | Save As to save the form as an .oft Outlook template file.
  2. Choose View | Toolbars | Customize.
  3. Drag any button from the Commands tab of the Customize dialog to the toolbar. 
  4. Right-click the new button, and enter a new Name. If you include an ampersand (&), the letter following the ampersand is assigned as a hotkey for the button. You will be able to run the form simply by pressing Alt plus that key.
  5. Choose Assign Hyperlink | Open
  6. In the Assign Hyperlink dialog, select the .oft file
  7. Click OK, then Close to finish adding the hyperlink button.

Again, as noted above, this technique works only for simple .oft files, such as boilerplate messages. It does not work at all in Outlook 2003. Thanks to Stephen Monty of the Department of Agriculture, Fisheries and Forestry - Australia for this tip, which he shared on the outlook-users mailing list. Also see:

If the form has been published rather than saved as an .oft file, you can use one of these methods:

  • Create a Windows shortcut, as described above, then create a hyperlink on a toolbar button, pointing to that shortcut file.
  • Add a button to run an Outlook VBA macro that launches the form using the Items.Add method described above (see below for code sample links)
  • For Outlook 2003 (but not Outlook 2007), use our custom Form Launcher form to create a library of forms in a public folder, each capable of being launched from an Outlook link such as
<Outlook://Public Folders/All Public Folders/Forms/~Sales Contact>
From a macro

You can write a macro in Outlook VBA, then follow the above instructions for creating a toolbar button, dragging the macro from the Macros heading under Commands. See:

As a default form

Default forms are those that launch from the File | New menu. You can substitute a custom form for any of the default forms. See:

From a web page

Launching a custom form from a web page requires the same Items.Add method as a VBA macro. See: