Microsoft KB Archive/248689

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 13:51, 21 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base

OFF97: Cannot Turn Off Customize Dialog Box by Using Macro to Disable Toolbars Submenu

Article ID: 248689

Article Last Modified on 6/18/2005


  • Microsoft Office 97 Standard Edition

This article was previously published under Q248689


When you try to turn off the Customize dialog box (on the View menu, click Toolbars) by running the following Visual Basic for Applications code

Application.CommandBars("Toolbar List").Enabled=False

the Customize dialog box still appears when you double-click a blank area of a toolbar.

NOTE: The preceding code turns off the Toolbars submenu on the View menu.


Office 97 does not allow you to have direct control over built-in dialog boxes.


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 cannot completely turn off the Customize dialog box in Office 97. However, you can turn off the functionality within the dialog box itself by inserting the code that is included in the following steps:

  1. Start an Office 97 program.
  2. Press ALT+F11 to open the Visual Basic Editor.
  3. Insert the following macro into a code module:

    Sub DisableCustomizeDlgUsage()
        Dim cb As CommandBar
        On Error Resume Next
        For Each cb In Application.CommandBars
        If <> (msoBarNoChangeDoc + msoBarNoResize) Then
            cb.Protection = msoBarNoCustomize + msoBarNoChangeVisible
        End if
    End Sub
  4. Run the macro, and then open the Customize dialog box.
  5. Try to modify a toolbar or toolbar button.


You can turn off the Customize dialog box by removing the Toolbars submenu from the View menu. However, if you right-click or double-click on an empty spot on a toolbar, the Customize dialog box appears again.

NOTE: Although Office 97 does not give EventHandler access to CommandBars to circumvent this behavior, Microsoft Office 2000 does.

Additional query words: Office97 XL97 Toolbars vba OFF97 disable disables disabling

Keywords: kbbug kbfix kbdtacode KB248689