Microsoft KB Archive/322145

From BetaArchive Wiki

Article ID: 322145

Article Last Modified on 11/19/2005



APPLIES TO

  • Microsoft Outlook 2002 Standard Edition
  • Microsoft Outlook 2000 Standard Edition



This article was previously published under Q322145

SUMMARY

This article describes various methods that you can use to make a custom Outlook form more accessible to users.


MORE INFORMATION

Although this article primarily describes forms that are published in the Organizational Forms Library, you can apply the concepts in this article to forms that are published in the personal forms library.

Because of the way that Outlook is designed, if you want to open a custom form that is published to the Organizational Forms Library, you have to use the Choose Form window. However, you typically have to perform a few steps to gain access to this window. You may want to simplify the process to open forms.

You can make Outlook forms more accessible to users in a variety of ways. To use some of these methods, users just have to change the Outlook user interface. To use other methods, you have to develop custom solutions. You can deploy many of these methods.

Opening Forms in Outlook

You can use the following methods if you want users to open custom forms in Outlook.

Using the Default Menu Commands

By default, users can open a form in the Organizational Forms Library by clicking the File menu, pointing to New, and then clicking Choose Form. You can also point to Forms on the Tools menu, and then click Choose Form. The disadvantages of using this method are:

  • The forms are not easy to find. -and-


  • You have to use repetitive steps to open a form.

Adding the "Choose Form" Command to a Toolbar

To make gaining access to the Choose Form window simpler, you can customize the toolbar by adding the Choose Form command to a toolbar:

  1. On the View menu, point to Toolbars, and then click Customize.
  2. Click the Commands tab if it is not already selected.
  3. Under Categories, click Tools.
  4. Under Commands, and then drag Choose Form to a toolbar.
  5. Click Close.

Organizations can roll out custom toolbars so that users do not have to manually add the Choose Form command. For additional information, view the documentation in the Microsoft Office Resource Kit. To view the Office Resource Kit, visit the following Microsoft Web site:

Creating a Microsoft Visual Basic for Applications Macro Solution

You can create an Outlook Visual Basic for Applications (VBA) macro to open a custom Outlook form. However, Outlook VBA is not designed to be deployed. Therefore, implement this solution for personal use only. For additional information about creating a VBA macro to open a form, click the article numbers below to view the articles in the Microsoft Knowledge Base:

290803 OL2002: How to Open a Form from a Toolbar Button


231174 OL2000: How to Open a Form from a Toolbar Button


Creating a Component Object Model Add-in Solution

You can create an Outlook Component Object Model (COM) add-in to add one or more custom toolbar buttons to open a form. You can also add form names directly to an Outlook menu, or even add a new top-level menu named Forms. The advantage of developing a COM add-in is that this is the supported way to deploy an Outlook solution. You must install and register the COM add-in on every computer.

For additional information about Outlook COM add-ins and how to create them, click the article numbers below to view the articles in the Microsoft Knowledge Base:

291163 OL2002: How to Create a COM Add-in for Outlook


230225 OL2000: How to Create a COM Add-in for Outlook


The following Microsoft Visual Basic version 6.0 sample code provides a basic outline of how to create a custom toolbar with a button to open a custom Task form. Copy this code in a Visual Basic Add-in project. For Microsoft Office XP, make sure that you reference the Microsoft Outlook 10.0 Object Library and the Microsoft Office 10.0 Object Library. For Microsoft Office 2000, make sure that you reference the Microsoft Outlook 9.0 Object Library and the Microsoft Office 9.0 Object Library.

Dim WithEvents cmdBtn1 As Office.CommandBarButton
Dim objOL As Outlook.Application

Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ 
            ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ 
            ByVal AddInInst As Object, custom() As Variant)
   Set objOL = Application
   CreateButton
End Sub

Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As _
            AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
   Set cmdBtn1 = Nothing
   Set objOL = Nothing
End Sub

Sub CreateButton()
   Dim cmdToolbar As Office.CommandBar
   Set cmdToolbar = objOL.ActiveExplorer.CommandBars.Add("Test CMD1", _
                    msoBarTop, , False)
   cmdToolbar.Visible = True
    
   Set cmdBtn1 = cmdToolbar.Controls.Add(Type:=msoControlButton)
   cmdBtn1.Style = msoButtonCaption
   cmdBtn1.Visible = True
   cmdBtn1.Caption = "Create Custom Task"
   cmdBtn1.Tag = cmdBtn1.Caption
   Set cmdToolbar = Nothing
End Sub


Private Sub cmdBtn1_Click(ByVal Ctrl As Office.CommandBarButton, _
            CancelDefault As Boolean)
   Dim objTasks As Items
   Dim objTask As TaskItem

   ' Change the folder to the location in which you want to store the item.
   ' For a message form, you can reference any folder, but the Inbox
   ' is the preferred folder to work with.
   Set objTasks = objOL.Session.GetDefaultFolder(olFolderTasks).Items

   ' Change the message class as appropriate to the target custom form.
   Set objTask = objTasks.Add("IPM.Task.myTaskFormName")
   objTask.Display
   Set objTasks = Nothing
   Set objTask = Nothing
End Sub
                

For additional information about how to programmatically reference other folders, click the article numbers below to view the articles in the Microsoft Knowledge Base:

290804 OL2002: Programming Examples for Referencing Items and Folders


208520 OL2000: Programming Examples for Referencing Items and Folders


Opening Forms Outside Outlook

You can also use operating system features to start Outlook forms. Typically, use this method if you want to add icons to the Microsoft Windows desktop or add links to forms on the Windows Start menu.

Using Outlook Shortcuts

Outlook supports various command-line switches. You can use one of these switches to specify a custom message class to open a form. You can create a shortcut to Outlook by using this command-line switch to open a form. You can do so even if Outlook is already running. For example, to open a custom mail message form called My Custom Form, use the following command-line switch:

"C:\Program Files\Microsoft Office\Office10\Outlook.exe" /c "IPM.Note.My Custom Form"


For additional information about using command-line switches in Outlook, click the article numbers below to view the articles in the Microsoft Knowledge Base:

296192 OL2002: Additional Command-Line Switches


197180 OL2000: Additional Command-Line Switches


Using Outlook Template (.oft) Files

You can save an Outlook form as an Outlook Template (.oft) file. Users can open the form by opening the .oft file from the file system. You can store the forms on a server and put shortcuts to the form on the users' desktops. Alternatively, you may want to put a shortcut to the folder that contains the form. Because these forms are not published, they are considered "one-off" forms. Using this approach may cause issues if you use Microsoft Visual Basic Scripting Edition (VBScript) code in the forms:

  • If you use versions of Outlook that have the Security Update features installed (by default, these features are included with Outlook 2002), the code in the form does not run unless an administrator customizes the Outlook security settings on the Exchange computer.
  • VBScript code in one-off forms generates a security warning that prompts the user to enable or disable the code in the form, which is typically undesirable.

Because one-off forms behave this way, avoid using .oft files. Publish forms instead.


REFERENCES

For additional information about an overview of programming with CommandBars and a sample that shows how to programmatically add a toolbar button to open an Outlook form, click the article number below to view the article in the Microsoft Knowledge Base:

201095 OL: How to Use CommandBars in Outlook Solutions


For additional information about available resources and answersto frequently asked questions about Microsoft Outlook solutions, click the article numbers below to view the articles in the Microsoft Knowledge Base:

287530 OL2002: Questions About Custom Forms and Outlook Solutions


146636 OL2000: Questions About Custom Forms and Outlook Solutions



Additional query words: OutSol OutSol2000 OutSol2002

Keywords: kbhowto kbaddin kbprogramming kbforms kbvba kbopenfile KB322145