Article ID: 231174 - Last Review: November 23, 2006 - Revision: 3.2 OL2000: How to Open a Form from a Toolbar ButtonThis article was previously published under Q231174 On This PageSUMMARY
This article explains how to use Outlook Visual Basic for Applications to open a custom Outlook form directly from the Outlook toolbar. NOTE: You cannot use the code in this article to open forms created using the Exchange Forms Designer or other MAPI forms created using C++. The Items.Add method in the Outlook object model only works with Outlook forms. MORE INFORMATION
You can create a Visual Basic for Applications macro that opens a custom form. You can then assign the macro to a toolbar button or a menu so that the form can be easily opened. To Create a Custom FormIf you already have a custom form stored in your Inbox and know the message class of the form, you can skip this section and go to the next section.
To Create the Visual Basic for Applications CodeMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs.If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104) Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice) For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms) To create the code to open the form, follow these steps:
To Create the Toolbar Button
To Modify the CodeThis code can be used with any mail message form, regardless of whether it is published in the Personal Forms Library, Organizational Forms Library, or the Inbox folder. However, other types of forms are typically published in a folder and the resultant items are saved to that folder. This would typically be the case if you create a custom contact form, for example.You may need to alter the code so that the custom form can be found in a specific folder (the folder it was published in) and so the item is saved in the correct folder; the following line of code is critical to this:
For more information on how to reference other folders in Outlook, please see the "Referencing Existing Folders" section of the following article in the Microsoft Knowledge Base: 208520
(http://support.microsoft.com/kb/208520/EN-US/
)
OL2000: Programming Examples for Referencing Items and Folders
Examples of Opening Other FormsTo open a default contact item, change the code to:To Open the Choose Forms Dialog BoxInstead of creating Visual Basic for Applications code to open a form, you may prefer to open the Choose Forms dialog box from a toolbar button. To do this without programming, follow these steps:
REFERENCES
For additional information about available resources and answers
to commonly asked questions about Microsoft Outlook 2000 solutions,
please see the following article in the Microsoft Knowledge Base: 146636
(http://support.microsoft.com/kb/146636/EN-US/
)
OL2000: Questions About Custom Forms and Outlook Solutions
| Article Translations
|
Back to the top
