Finding and Replacing Text Boxes

by Allen Wyatt
(last updated January 14, 2017)

3

Tim wonders if Find and Replace can be used to search for and locate text boxes. He would like to search for text boxes and replace each of them with a graphic, as he finds this almost impossible to do manually when some text boxes are essentially invisible in his document.

If your text boxes are inline with your text, then you can use Find and Replace to locate and replace them. All you need to do is to display the Replace tab of the Find and Replace dialog box and, in the Find What box, enter ^g. This is the code for find graphics, but Word treats text boxes as of they are graphics when they are inline.

The problem is, of course, that most text boxes are not inline—text wraps around them and they reside on their own layer. For these types of text boxes you must use a macro to do the searching and replacing. The following is an example of one you could use:

Sub ReplaceTextBox()
    Dim shp As Shape

    For Each shp In ActiveDocument.Shapes
        If shp.Type = msoTextBox Then
            shp.Select
            shp.Delete
            Selection.PasteAndFormat (wdPasteDefault)
        End If
    Next
End Sub

To use the macro, select the graphic you want to use in your replacement and then press Ctrl+C. This places the graphic in the Clipboard. When you run the macro, it is this graphic—the one in the Clipboard—that is pasted into the document in place of each text box.

You should be aware that the macro replaces all of the text boxes in a document with the graphics. If you wanted to selectively replace text boxes, the coding would be a good deal more complex.

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

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

Changing Toolbar Location

Toolbars don't need to be tethered to the top of your program window. Although they are right at home there, you may want ...

Discover More

Understanding Pattern Matching

Pattern matching is a type of searching you can do in Word that is very powerful. Despite its power, it remains rather ...

Discover More

Quickly Inserting Table Rows

Need to pop a few extra rows into a table? It is easy to do using the same tools you used to create the table in the first ...

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)

Using Find and Replace to Change Text Case

Can you really use Find and Replace to change the case of text in your document? Not really, but that shouldn't stop you from ...

Discover More

Removing HTTP from URLs

Having problems when it comes to replacing information in URLs? You're not the only one; it can be confusing making mass ...

Discover More

Getting Rid of Hidden Text in Many Files

Hidden text is a great boon if you want to make sure something doesn't show up on the screen or on a printout. If you want to ...

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 for this tip:

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. 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 8 - 1?

2017-01-16 09:38:49

Eileen

does this also work in PowerPoint or is there an equivalent?

Thanks!


2017-01-14 07:25:35

Ken Endacott

You can use the Object Browser to step through the tables in a document, then if required convert a table to text. These functions are described in:
WordTips “Using the Object Browser”
WordTips “Converting a Table into Text”


2017-01-14 04:56:42

Dave

Can I do this I find to find tables? I sometimes have documents with large amounts of tables and I would like to easily adjust them or convert them as the need arises. What are my options here? Thanks.


Newest Tips
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.

Links and Sharing
Share