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”
- First and foremost, click “Home” tab.
- Then click “Select” icon in “Editing” group.
- Next, on the drop-down menu, choose “Selection Pane”.
- Now on the right side of the screen, you can see all text boxes visible on the pane.
- Press “Ctrl” and click those text box names on the pane one by one to select them all.
- And move to lay cursor on one of the box line and right click.
- On the list-option, click “Copy”. Now if you won’t need those boxes anymore, just press “Delete”.
- Next click “Start” to view the Windows menu.
- Choose “WordPad” and open it.
- Then click “Paste” to get all texts from the text boxes.
- Next, select all texts and right click to choose “Copy”.
- Now open a new Word document and right click to choose “Keep Text Only” to get the text.
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.
- Firstly, press “Alt+ F11” to open the VBA editor.
- Secondly, click “Normal” and then “Insert”.
- Next choose “Module” to insert a new one.
- Then double click on the module name to open the editing area.
- Paste the following codes and 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:
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.
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