Loading
Word.Tips.Net WordTips (Menu Interface)

Removing All Text Boxes In a Document

Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Removing All Text Boxes In a Document.

If you do a lot of work with documents from other people, you may have a need to remove text boxes in those documents. If there are only one or two text boxes in the document, it is not that difficult to select them and delete them. What if there are 30, 40, or more text boxes, though? Deleting them individually can quickly get tedious.

One potential solution is a "brute force" method. Follow these steps:

  1. In your document, press Ctrl+A. The entire document is selected.
  2. Press Ctrl+C. The document is now on the Clipboard.
  3. Open a new, blank document.
  4. Choose Paste Special from the Edit menu. Word displays the Paste Special dialog box. (See Figure 1.)
  5. Figure 1. The Paste Special dialog box.

  6. In the list of formats, choose Unformatted Text.
  7. Click on OK.

The document text, minus the text boxes, is now in the new document. The obvious drawback to this approach is that the other formatting of the original document is also lost, and you must reformat the entire document. (I told you this was a brute force method.)

If you want to get rid of only the text boxes, then the quickest solution is to use a macro. The following macro will quickly remove all text boxes in your document:

Sub RemoveTextBox1()
    Dim shp As Shape
    For Each shp In ActiveDocument.Shapes
        If shp.Type = msoTextBox Then shp.Delete
    Next shp
End Sub

You should realize that this macro removes all of the text boxes and their contents. In other words, if a text box is used for placement of text, then the text in that text box is deleted along with the text box itself.

If you prefer to transfer the text from the text boxes to the document, prior to deleting the text box, then a slight modification on the above macro will work:

Sub RemoveTextBox2()
    Dim shp As Shape
    Dim oRngAnchor As Range
    Dim sString As String

    For Each shp In ActiveDocument.Shapes
        If shp.Type = msoTextBox Then
            ' copy text to string, without last paragraph mark
            sString = Left(shp.TextFrame.TextRange.Text, _
              shp.TextFrame.TextRange.Characters.Count - 1)
            If Len(sString) > 0 Then
                ' set the range to insert the text
                Set oRngAnchor = shp.Anchor.Paragraphs(1).Range
                ' insert the textbox text before the range object
                oRngAnchor.InsertBefore _
                  "Textbox start << " & sString & " >> Textbox end"
            End If
            shp.delete
        End If
    Next shp
End Sub

When this macro is done, you can do a search for "Textbox start" and you will be at the beginning of text that used to be in the text boxes that are now gone from your document. You can then edit the text so that it appears as you want.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1690) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Removing All Text Boxes In a Document.

Related Tips:

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!

 

Leave your own comment:

*Name:
Email:
  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*Text:
*What is 5+3 (To prevent automated submissions and spam.)
 
 
           Commenting Terms

Comments for this tip:

Thomas Strømdahl    04 Apr 2016, 12:21
I can't see that RemoveTextBox1 deletes texboxes in header/footer. Looks like you have to loop through all story ranges and shape ranges. If you use for each shape in shaperanges and delete it, it misses to delete all.

This works bettter on my documents:
Sub RemoveAllTextBoxes()
    Dim rStory As Range
    Dim shp As Shape
    Dim ShapeNo As Integer
    
    For Each rStory In ActiveDocument.StoryRanges
        For ShapeNo = rStory.ShapeRange.Count To 1 Step -1
            Set shp = rStory.ShapeRange(ShapeNo)
            If shp.Type = msoTextBox Then shp.Delete
      Next ShapeNo
   Next rStory
End Sub
ELLIOT    30 Nov 2015, 02:39
I DIDN'T KNOW HOW TO USE EXCEL OR ANY ONLINE PROGRAMMING THING BUT I WENT TO THESE TWO SITES: https://www.youtube.com/watch?v=sQWlwSnWI2g
https://www.youtube.com/watch?v=6LpKsQtOSPQ
AND THEY EXPLAINED HOW TO PUT IN A MACRO

I SELECTED ALL THE TEXT BOXES AND PRESSED RUN PROGRAM (ALL 62 TEXT BOXES) AND RAN THE PROGRAM.

PROBLEM: I HAD THE PROGRAM RUNNING FOR A COUPLE MINUETS AND NOTHING HAPPENED, SO I STOPPED IT AND DON'T KNOW WHAT TO DO NOW.
ALSO, I CAN'T GET THE COMMENTS TO WORK, WHEN TRYING IT THE FIRST TIME.
 
PS:
    ALSO, I DON'T KNOW WHAT 4+5=
I'M JUST KIDDING, ABOUT THAT. I'M NOT A ROBOT.
 
 

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us

 

Advertise with Us

Our Privacy Policy

Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)

Gardening

Health

Home Improvement

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives

 

Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2016 Sharon Parq Associates, Inc.