O'Reilly logo

Access™ 2007 VBA Programmer's Reference by Armen Stein, Geoffrey Griffith, Rob Cooper, Teresa Hennig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12.2. Custom Menu Bars and Toolbars

If you built custom menu bars and toolbars in previous versions of Access, you might wonder what happens to those in Access 2007. Well, don't worry—you can still use them in Access 2007, although their appearance may be different than what you are used to.

12.2.1. Custom Menu Bars

Custom menu bars that you created in previous versions of Access will appear as a menu bar as long as you have set the Allow Full Menus property to No. In previous versions of Access, this property appears in the Startup dialog box under the Tools menu. If you have not set this property, custom menu bars will appear on a separate tab in the Ribbon called Add-Ins.

12.2.2. Shortcut Menu Bars

The shortcut menu bars that you created for forms in previous versions of Access will continue to work in Access 2007. They will appear on the context menu, not in the Ribbon. However, the tools for creating toolbars and menu bars have been removed. Unfortunately this means there is no way to create a new shortcut menu bar unless you write code or use a previous version of Access.

The following code (which requires a reference to the Microsoft Office 12.0 Type Library) creates a shortcut menu with two button controls. For more information about the CommandBar object model, please visit the MSDN website at http://msdn.microsoft.com.

Public Sub CreateShortcutMenu(strName As String) Dim objCommandBar As Office.CommandBar Dim objCommandBarControl As Office.CommandBarControl ' create ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required