ACC97: How to Dim Menu Items or Disable Toolbar Buttons in CodeLast reviewed: February 4, 1998Article ID: Q160293 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. This article demonstrates a method to dim or disable items on a menu bar, toolbar, or shortcut menu in Microsoft Access 97. This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications with Microsoft Access 97" manual.
MORE INFORMATIONThe CommandBars collection in Microsoft Access 97 exposes all menu bars, toolbars, and shortcut menus in your application to Visual Basic for Applications so you can manipulate them programmatically. Using the properties and methods of the CommandBars collection in your application, you can manipulate and customize both built-in and custom command bars. NOTE: If you use Windows application programming interface (API) procedures to manipulate menus in your Microsoft Access 2.0 or 7.0 database, you must modify the code to use the CommandBars object model in Visual Basic for Applications when you convert your database to Microsoft Access 97. Windows API calls do not work with Microsoft Access 97 menus, toolbars, or shortcut menus. Each command bar, whether it is a menu bar, a toolbar, or a shortcut menu, consists of a collection of CommandBarControl objects. You can create three types of CommandBarControls on a command bar, each with its own methods and properties:
CommandBars("Test").Controls("ClickMe") CommandBars("Test").Controls(1)The following example shows you how to disable or enable items on a menu bar or toolbar based on events in your application.
REFERENCESFor more information about command bars, search the Help Index for "CommandBars collection," or ask the Microsoft Access 97 Office Assistant. For more information about creating and modifying command bars using Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q159692 TITLE : ACC97: How to Create Command Bars Using Visual Basic CodeFor more information on how to programmatically add and remove items on command bars, please see the following article(s) in the Microsoft Knowledge Base:
ARTICLE-ID: Q172300 TITLE : ACC97: Command Bar Wizard Available on MSL Keywords : kbusage PgmObj UifToolb Version : 97 Platform : WINDOWS Hardware : x86 Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |