Microsoft KB Archive/291421

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

Article ID: 291421

Article Last Modified on 3/1/2004

-

APPLIES TO


 * Microsoft Outlook 2002 Standard Edition

-



This article was previously published under Q291421





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



WORKAROUND
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(&quot;Menu Bar&quot;) 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.



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



MORE INFORMATION
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.

