12.8. Customizing the Office Menu

As mentioned earlier, the Office menu is updated when you create a new Ribbon from scratch. In addition to the changes made by the Ribbon, you can also customize the Office menu to suit your needs. In Office 2007, the Office menu is intended for options that affect an entire document or application.

To customize the Office Menu, use the officeMenu node, which is a child of the Ribbon node as shown below.

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    <ribbon startFromScratch="true">
        <officeMenu>
            <button idMso="FileNewDatabase" visible="false"/>
            <button idMso="FileOpenDatabase" visible="false"/>
            <button idMso="FileCloseDatabase" visible="false"/>
            <splitButton idMso="FileSaveAsMenuAccess" visible="false"/>
        </officeMenu>
    </ribbon>
</customUI>

This XML hides the built-in buttons for New, Open, Close, and the Save As group in the Office menu in Access. You should provide another means of closing your application gracefully if you choose to hide the Close button.

Let's look at another scenario for which you might customize the Office menu. Say you have a list of links you want to provide in your application. In the case of the travel agency application, you might maintain a list of links to travel sites, airline websites, or mapping sites. You can display this list in the Office menu so that it is available from anywhere in the application.

The following XML includes a menu node in the Office menu.

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> ...

Get Access™ 2007 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.