OL2002: Form Menu and Layout Menu Appear When You Use a Custom Form

Article translations Article translations
Article ID: 291421 - View products that this article applies to.
This article was previously published under Q291421
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all


When you use a custom Microsoft Outlook form, both the Form menu and the Layout menu appear at the top of the form.


You can workaround this problem by adding Visual Basic Scripting Edition (VBScript) code to the form that will programmatically remove the Form and Layout menus when an item is opens. The following code will accomplish this:
Sub Item_Open()
   FormMenusVisible False
End Sub

Sub Item_Close()
   FormMenusVisible True
End Sub

Sub FormMenusVisible(boolVisible)
   Dim objCommandBar
   Dim objCBMenu
   Set objCommandBar = Item.GetInspector.CommandBars.Item("Menu Bar")
   Set objCBMenu = objCommandBar.FindControl(, 30145)
   objCBMenu.Visible = boolVisible
   Set objCBMenu = objCommandBar.FindControl(, 30146)
   objCBMenu.Visible = boolVisible

   Set objCBMenu = Nothing
   Set objCommandBar = Nothing
End Sub
NOTE: This code will also hide the two menus when you enter form design mode. To work around this side effect you can hold down the Shift key when opening the form to prevent the code from running.


Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.


Both the Form and Layout menus ought to only appear when the form is in design mode. However, if you change any of the default actions on a form, the menus also appear when you use the form. Most of the commands on each of these menus are disabled, so you cannot perform any actions by using these menus. However, the one exception is the View Code command, which means that users of the form can easily access and view custom script written in Visual Basic Scripting Edition (VBScript) behind a custom Outlook form.

NOTE: This behavior does not occur in Outlook 97 or Outlook 98, but does occur in Outlook 2000.


For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:
287530 OL2002: Questions About Custom Forms and Outlook Solutions


Article ID: 291421 - Last Review: October 23, 2013 - Revision: 1.3
  • Microsoft Outlook 2002 Standard Edition
kbnosurvey kbarchive kbbug kbnofix KB291421

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com