In this article bellow, we want to show you 3 ways to batch change text format in all text boxes in your Word document.
Text boxes are often seen in out documents. While format document texts, we cannot forget those in text boxes. However, text boxes scattering in a document can make you hard to select all texts inside once and for all. Therefore, out of formatting purposes, it’s urgent to learn some trick to do the batch processing.
Method 1: Utilize “Advanced Find” Feature
- First of all, click “Home” tab and go to click the arrow button behind “Find” command in “Editing” group.
- Next on the drop-down list, choose “Advanced Find” to open the “Find and Replace” dialog box.
- Put cursor at “Find what” text box and enter “^?” there.
- Then click “Find In” button and choose “Text Boxes in Main Document”.
- Now you can see all texts in text boxes are in selection. In case you may forget the string to be put in “Find what” box, you can click “More” button to open more options in the box and then click “Special”. Next choose “Any Character”.
- With all texts in selection, just format them as required.
Method 2: Batch Change Text Format in All Text Boxes in One Document
- To start off, press “Alt+ F11” in Word to trigger VBA editor.
- Next click “Normal”.
- Then click “Insert” tab and choose “Module”.
- And double click the new module and paste the bellowing macro there:
Sub FormatTextsInTextBoxes() Dim objShape As Shape Dim objDoc As Document Set objDoc = ActiveDocument With objDoc For Each objShape In .Shapes If objShape.Type = msoTextBox Then objShape.TextFrame.TextRange.Font.Name = "Arial" objShape.TextFrame.TextRange.Font.Size = "16" End If Next End With End Sub
- Finally, click “Run”.
This macro sets all text box texts in “Arial” font at 16 pt. You may alter these setting as need.
Method 3: Batch Change Text Format in All Text Boxes in Multiple Documents
Now that we are talking about batch processing, we cannot eliminate the need to do it among multiple files.
- Firstly, arrange all target documents under the same directory.
- Next install and run macro as you do in method 2. This time replace those codes with the following ones:
Sub FormatTextsInTextBoxesInMultiDoc() Dim strFile As String Dim strFolder As String Dim objDoc As Document ' Initialization strFolder = InputBox("Enter folder path here: ") strFile = Dir(strFolder & "*.docx", vbNormal) ' Process each file in the folder. While strFile <> "" Set objDoc = Documents.Open(FileName:=strFolder & strFile) Set objDoc = ActiveDocument With objDoc For Each objShape In .Shapes If objShape.Type = msoTextBox Then objShape.TextFrame.TextRange.Font.Name = "Arial" objShape.TextFrame.TextRange.Font.Size = "16" End If Next End With objDoc.Save objDoc.Close strFile = Dir() Wend End Sub
- While running the macro, there will be an input box prompting up, such as bellow:
- Enter the folder address at the text box and click “OK”. Don’t forget to add a “\” at the end of your path string. Then just wait Word to do its job.
Make Full Preparation while You Can
We understand it’s hard to even think about your file getting corrupt. However, we can never overlook this possibility which, to be honest, is relative high. Anyway, it’s less troublesome to take preventive measures than hopping around for a doc fix tool.
Author Introduction:
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including fix Excel and pdf repair software products. For more information visit www.datanumen.com