Printing Images Based on Hidden Text Setting

Written by Allen Wyatt (last updated December 11, 2021)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and 2021


David is a teacher and he uses Word to create tests and answer sheets. He uses a single document, formatting answers as Hidden text. This way, if he prints with Hidden text turned off, he has the test and if he prints with Hidden text turned on, he has the test and answers. David needs a way to include two images in the document, one on top of the other. That's not the puzzling part, though. He needs one of those images to print if he's printing with Hidden text turned on and the other to print if he's printing with Hidden text turned off.

There are actually a couple of ways you can approach this problem. The first way involves the use of inline images, which can be formatted just like text. This means they can be formatted as Hidden. Assume, for the sake of this example, that you have two images, A and B. You want image A to be printed when you print without Hidden text, and you want B to be printed when you print including Hidden text. Follow these general steps:

  1. Add image A as an inline picture.
  2. Add image B below or next to it, also as an inline picture.
  3. Select image B and format it as Hidden. (Mark it as Hidden the same way you do your other Hidden text.)
  4. Set image B's wrapping to "In front of text."
  5. Move image B to above or in front of image A.

Now the correct images will print depending on whether you print with Hidden text displayed or not. If you want, you could also make image A floating; it doesn't need to be inline. Only image B must be inline, as it is only inline images that can be formatted as Hidden. In addition, image B should be opaque, meaning it should not have any transparent areas, and it should be the same size as image A. If image B does have transparent areas or if it is smaller than image A, then it won't fully obscure image A when it is printed.

The other option is to create a macro that you run whenever you want to print your document. The macro can check the setting of the PrintHiddenText property and based on the setting, either display or hide the appropriate images. Here's a quick example:

Sub PrintMyDoc()
    If Application.Options.PrintHiddenText = True Then
        ActiveDocument.Shapes(1).Visible = msoTrue
        ActiveDocument.Shapes(2).Visible = msoFalse
    Else
        ActiveDocument.Shapes(1).Visible = msoFalse
        ActiveDocument.Shapes(2).Visible = msoTrue
    End If
End Sub

In this macro, the first shape in the Shapes collection is set to Visible (and thus will be printed) if you are printing Hidden text. If the PrintHiddenText property is False, then the second shape is made visible and will thus be printed.

The key to using this macro approach is that you must use regular shapes (floating images); you can't use InlineShapes, as those cannot have the Visible property set.

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 (13375) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 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

Putting Tables within Margins

When you first insert a table in your document, it extends from margin to margin. Later, after a bunch of editing and ...

Discover More

Editing a Comment Close to Its Cell

Have you ever chosen to edit a comment, only to find that the comment is quite a ways from the cell with which it is ...

Discover More

Beginning of a Future Week

Because Excel stores dates internally as serial numbers, it makes doing math with those dates rather easy. Even so, it ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

Using Sequential Document Serial Numbers

Need to add a unique serial number to each printed copy of your document? Here's a quick way to print such numbered versions.

Discover More

Creating Tent Cards

If you are planning a dinner party or a meeting where guests need to be seated at tables, you may want to create tent ...

Discover More

Controlling Where a Full-page Border is Printed

When you add full-page borders to your document, you may be bothered to find out that one or more sides of the border ...

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 one minus 0?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.