In today’s article, we would like to show you 2 ways to batch change texts to superscript or subscript in your Word document.
Sometimes, we need to change certain texts in Word document to superscripts or subscripts, especially when there are multiple instances of the same text. Under such circumstances, batch replacement is what we need most. For this reason, we offer 2 Quick methods for you to accomplish the task.
Method 1: Use “Find and Replace” Feature
In the coming contents, we will use the sample “DataNumen Word Repair v2.5” as our demonstration. Our aim is to replace the “v2.5” as subscript.
- First and foremost, click “Home” tab.
- Next click “Replace” to open the “Find and Replace” dialog box.
- First enter “ v2.5” in “Find what” text box. Don’t forget enter a space before text.
- Then enter “v2.5” in “Replace with” text box. There is no space before the text this time.
- Next click “More” button to expand more options.
- Now click “Format” and choose “Font”.
- In the “Find Font” dialog box, check the either “Superscript” or “Subscript” box.
- Then click “OK”.
- Finally click “Replace All” button.
You can check the effect here:
Method 2: Batch Replace by Running Word Macro
- To begin with, press “Alt+ F11” to trigger the VBA editor.
- Then click “Normal” project and “Insert” tab next.
- Choose “Module” on the drop-down menu.
- Next double click on the new module to open the coding area.
- Paste the following macro there:
Sub ReplaceTheTextAsSubscript() Dim strSelectText As String Dim strReplaceText As String strSelectText = InputBox("Enter the text you want to search", "Select text", "For example: v2.5") strReplaceText = InputBox("Enter the text you want to replace with", "Replace text", "For example:v2.5") Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find.Replacement.Font .Superscript = False .Subscript = True End With With Selection.Find .Text = strSelectText .Replacement.Text = strReplaceText .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
- Click “Run”.
- First there is the “Select text” box. Input your finding text and click “OK”. In this case, type “ v2.5”.
- Then there is the “Replace text” box. Input the replacing text there and click “OK”. Type “v2.5”.
If you need to change texts to superscript, you can use this macro:
Sub ReplaceTheTextAsSuperscript() Dim strSelectText As String Dim strReplaceText As String strSelectText = InputBox("Enter the text you want to search", "Select text", "For example: v2.5") strReplaceText = InputBox("Enter the text you want to replace with", "Replace text", "For example:v2.5") Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find.Replacement.Font .Superscript = True .Subscript = False End With With Selection.Find .Text = strSelectText .Replacement.Text = strReplaceText .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
Fix Document Errors
Word errors are no stranger to most of us. A collapse Word can result in a corrupt docx file. To address such issue, you need to take hold of a qualified and professional tool to recover the broken document.
Author Introduction:
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupted xlsx and pdf repair software products. For more information visit www.datanumen.com
Leave a Reply