Minimizing the Ribbon for a Document

Written by Allen Wyatt (last updated March 19, 2022)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


1

Donna is in charge of preparing a document that will be used throughout her company. She would like the document, when opened, to "minimize" the ribbon at the top of the screen and then, when closed, return the ribbon to its "pre-opening" state. This would be done to provide the maximum screen area for the document. Donna figures that this will take a macro to accomplish, but she's not sure which commands to use to accomplish the task.

There is an amazing shortage of information available on working with the ribbon in VBA. In fact, the only method we've been able to locate that will minimize the ribbon is the following:

ActiveWindow.ToggleRibbon

This method is the same as pressing Ctrl+F1. It toggles the ribbon, changing it from maximized to minimized, and vice-versa. This, of course, is not what Donna wants to do; she wants to make sure it is minimized. Using the ToggleRibbon method, you can "fudge" a way to figure out whether the ribbon is minimized or not. Consider the following example macros.

Dim w As Variant
Dim h1 As Long
Dim h2 As Long
Dim StartedWithRibbon As Boolean

Private Sub Document_Open()
    Set w = ActiveWindow
    h1 = w.UsableHeight
    w.ToggleRibbon
    h2 = w.UsableHeight
    If h1 < h2 Then
        StartedWithRibbon = False
    Else
        StartedWithRibbon = True
        w.ToggleRibbon
    End If
End Sub
Private Sub Document_Close()
    Set w = ActiveWindow
    h1 = w.UsableHeight
    w.ToggleRibbon
    h2 = w.UsableHeight
    If h2 < h1 Then
        If StartedWithRibbon Then w.ToggleRibbon
    Else
        If Not StartedWithRibbon Then w.ToggleRibbon
    End If
End Sub

There are actually two macros here, one automatically triggered when a document is opened and the other triggered when it is closed. The macros check the height of the active window, storing it in the h1 variable. It then toggles the ribbon and again checks the active window height, storing it in h2. By comparing the two values, you can determine whether the ribbon is minimized or not and then act accordingly.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (8515) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Searching for Breaks

Word allows you to insert different types of breaks in your text that help control how your document is paginated. If you ...

Discover More

Colors No Longer Work

It can be disconcerting if you are editing a workbook and can no longer change colors for cells in the workbook. This tip ...

Discover More

Moving Comment Background Pictures to Cells

When formatting comments, you can use a graphic as a background for the comment box. If you later want to move this ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Determining the Upper Bounds of an Array

When working with variables in a macro, you may need to know the upper boundary dimension for an array. This can be ...

Discover More

Creating a Document Font List

If you want a list of all the fonts used in a document, the answer isn't as simple as you may think. This tip uses macros ...

Discover More

Moving Through a Table in a Macro

Do you need to step through a table, cell by cell, in a macro? It's easy to do using the Move method, as described in ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 7?

2022-03-21 12:41:31

Paul

Very clever!


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.