Microsoft KB Archive/184897

= XL98: Worksheet Menu Bar May Not Appear As Expected =

Article ID: 184897

Article Last Modified on 6/17/2005

-

APPLIES TO


 * Microsoft Excel 98 for Macintosh

-



This article was previously published under Q184897



SYMPTOMS
After you run a Microsoft Visual Basic for Applications macro to create a floating toolbar, only the Apple and Help menus appear on the menu bar.



CAUSE
This problem occurs when you attempt to replace the worksheet menu bar with a custom floating menu bar. To see an example of this behavior, please see the "More Information" section in this article.



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements. You may be able to work around this problem by changing the MenuBar argument of the Add method to False instead of True. The following sample macro creates a new toolbar but does not replace the menu bar: Sub Add_Toolbar

' The following line of code creates a floating toolbar that does not ' replace the menu bar. ' This is specified by the MenuBar argument, which in the code below, ' is set to False.

Application.CommandBars.Add "newbar", msoBarFloating, False, True

' Display the CommandBar.

CommandBars("newbar").Visible = True

End Sub



STATUS
This is by design in Microsoft Excel 98 Macintosh Edition.



MORE INFORMATION
On the Macintosh, the menu bar must remain at the top of the screen. Therefore, a macro ignores the floating argument and replaces the worksheet menu bar when you run a macro that contains code to create a floating menu bar.

Example
To see an example of this behavior, follow these steps:

 Start Microsoft Excel 98 with a new workbook. Press OPTION+F11 to start the Visual Basic Editor. On the Insert menu, click Module.  In the new module type the following: Sub Test_menubar

Application.CommandBars.Add "newbar", msoBarFloating, True, True CommandBars("newbar").Visible = True

End Sub

Sub Reset_Menubar

Application.CommandBars("Worksheet Menu Bar").Visible = True

End Sub  Press OPTION+F11 to return to Excel.</li> Press OPTION+F8.</li> Select the Test_menubar macro, and then click Run.

Note that the menu bar contains only the Apple and Help menus.</li></ol>

To reset the menu bar, follow these steps:


 * 1) Press OPTION+F8.
 * 2) Select the Reset_Menubar macro. Click Run

The original menu bar reappears.

<div class="references_section">