2 Quick Methods to Extract Texts from Text Boxes in Your Word Document

In this article, we want to show you 2 quick and easy to use methods to extract texts from text boxes in your Word document.

From time to time, we can get a Word file containing a large number of text boxes. Usually, there will be texts or relative contents inside those boxes. Then there can be the need to get only the texts inside instead of keeping the whole text box.

Certainly, it’s quick to retrieve words within one single text box simply by copying the text out and pasting it somewhere else. However, when it comes to hundreds of them, we’d better learn some quick tips to get the job done.

Method 1: Use the “Selection Pane”

  1. First and foremost, click “Home” tab.
  2. Then click “Select” icon in “Editing” group.
  3. Next, on the drop-down menu, choose “Selection Pane”.Click "Home"->Click "Select"->Click "Selection Pane"
  4. Now on the right side of the screen, you can see all text boxes visible on the pane.
  5. Press “Ctrl” and click those text box names on the pane one by one to select them all.
  6. And move to lay cursor on one of the box line and right click.
  7. On the list-option, click “Copy”. Now if you won’t need those boxes anymore, just press “Delete”.Select All Text Boxes ->Right Click on One of the Box Line ->Choose "Copy"
  8. Next click “Start” to view the Windows menu.
  9. Choose “WordPad” and open it.Click "Start" ->Click "WordPad"
  10. Then click “Paste” to get all texts from the text boxes.Click "Paste"
  11. Next, select all texts and right click to choose “Copy”.Click "Copy"
  12. Now open a new Word document and right click to choose “Keep Text Only” to get the text.Right Click on the New Document ->Choose "Keep Text Only"

Method 2: Use VBA Codes

As you may see, even with the first method, you can’t avoid selecting all text boxes. In case some of you just hate such labor work, here we are to offer you the way to run a macro. With method 2, you can extract all texts in one go and have the text boxes deleted.

  1. Firstly, press “Alt+ F11” to open the VBA editor.
  2. Secondly, click “Normal” and then “Insert”.
  3. Next choose “Module” to insert a new one.Click "Normal"->Click "Insert"->Click "Module"
  4. Then double click on the module name to open the editing area.
  5. Paste the following codes and click “Run”:Paste Codes->Click "Run"
Sub DeleteTextBoxesAndExtractTheText()
  Dim nNumber As Integer
  Dim strText As String

  '  Delete all textboxes and extract the text from them
  With ActiveDocument
    For nNumber = .Shapes.Count To 1 Step -1
    If .Shapes(nNumber).Type = msoTextBox Then
      strText=strText& .Shapes(nNumber).TextFrame.TextRange.Text & vbCr
      .Shapes(nNumber).Delete
    End If
  Next
  End With

  '  Open a new document to paste the text from textboxes.
  If strText <> "" Then
    Documents.Add Template:="Normal"
    ActiveDocument.Range.Text = strText
  Else
    MsgBox ("There is no textbox.")
  End If
End Sub

Here is what you are likely to get:Effect of Running a Macro

Cope with Wrecked Word Files

Word is prone to errors and hence a frequent victim to corruption. Therefore, you have to manage your documents properly to protect them from damage. For once they getting corrupted, you will face the risk of losing them permanently. Then you will have to use the corrupted Word data recovery tool.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including Excel file error recovery tool and pdf repair software products. For more information visit www.datanumen.com

8 responses to “2 Quick Methods to Extract Texts from Text Boxes in Your Word Document”

  1. Wow, superb weblog structure! How lengthy have you ever been blogging for?
    you make running a blog glance easy. The entire look of your website is magnificent, as well as the content material!
    You can see similar: Zabawka.shop and here Zabawka.shop

  2. This piece of writing gives clear idea for the new users of blogging, that in fact how to do running a blog.

  3. Corrected code:

    Sub DeleteTextBoxesAndExtractTheText()
    Dim nNumber As Integer
    Dim strText As String

    ‘ Delete all textboxes and extract the text from them
    With ActiveDocument
    For nNumber = .Shapes.Count To 1 Step -1
    If .Shapes(nNumber).Type = msoTextBox Then
    strText = strText & .Shapes(nNumber).TextFrame.TextRange.Text & vbCr
    .Shapes(nNumber).Delete
    End If
    Next
    End With

    ‘ Open a new document to paste the text from textboxes.
    If strText “” Then
    Documents.Add Template:=”Normal”
    ActiveDocument.Range.Text = strText
    Else
    MsgBox (“There is no textbox.”)
    End If
    End Sub

  4. Select all the text boxes.
    Past it into a XLS worksheet.
    Copy all the cells with the text.
    Paste the copied cells back in the Document.
    All the text is now in a table.
    Convert the table to text.

  5. This works great. What would you change to get the text to extract in the same order as they appear in the document?

  6. Note there’s an error in the code. You’ve forgotten the space between strText and the ampersand that follows.

Leave a Reply

Your email address will not be published. Required fields are marked *