Microsoft KB Archive/184897

From BetaArchive Wiki

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:

  1. Start Microsoft Excel 98 with a new workbook.
  2. Press OPTION+F11 to start the Visual Basic Editor.
  3. On the Insert menu, click Module.
  4. 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
                            
  5. Press OPTION+F11 to return to Excel.
  6. Press OPTION+F8.
  7. Select the Test_menubar macro, and then click Run.

    Note that the menu bar contains only the Apple and Help menus.

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.


REFERENCES

For more information about CommandBars, from the Visual Basic Editor, click the Office Assistant, type CommandBars Collection, click Search, and then click to view "CommandBars Collection Object."

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If the Assistant is not able to answer your query, please see the following article in the Microsoft Knowledge Base:

176476 OFF: Office Assistant Not Answering Visual Basic Questions



Additional query words: XL98 OFF98 WD98 PPT98

Keywords: kbprogramming kbprb kbdtacode KB184897