In the article below, we would like to provide you with 2 useful methods to do fuzzy search in your Word document.
It happens now and then that we are likely to forget how to correctly spell out a word, especially when it’s a long one. Most of time, we barely remember just a few beginning letters. This makes accurate search almost impossible.
Lucky for us, there are ways for fuzzy-search. And you can utilize them in your Word document.
Method 1: Use “Advanced Find” Feature in Word
In our case, we are going to search for “DataNumen”, supposing we just remember it beginning with “Data”.
- Firstly, in “Editing” group under “Home” tab, click the drop-down button next to “Find” command.
- And on that menu, select “Advanced Find” option.
- Then put insertion pointer inside “Find what” text box and paste following wildcards there:
<Data[a-zA-Z]{n,m}>
- “Data” are the beginning letters of target word. You should replace it with actual ones. In the event of you forgetting beginning letters, just leave it empty and don’t enter even a space.
- And “n,m” represents the number of the rest letter length of target word, excluding the beginning letters. Say, in this case, it is number “5”. So the wildcards should look like in this way:
<Data[a-zA-Z]{5}>
- If you are not sure about an accurate number of letter length, you can enter 2 numbers indicating a range, such as:
<Data[a-zA-Z]{5,7}>
- And if you are sure that the letter length is equal or larger that a specific number, then enter it in the expression, like this way:
<Data[a-zA-Z]{5,}>
- Next click “More” to bring out more options.
- Check the “Use wildcards” box.
- Then click “Find In” and choose “Main Document”.
You shall see all occurrences of target word in selection.
Method 2: Run VBA Codes to Search for Text
Running VBA codes can save you from memorizing the expression.
- First and foremost, press “Alt+ F11” to invoke VBA editor in Word.
- Next click “Normal” project and click “Insert” then.
- Choose “Module” on the menu.
- Double click on it to open and paste following codes there:
Sub FindTheWordsByLength() Dim objRange As Range Dim strStartWord As String Dim strLength As String strStartWord = InputBox("Enter the beginning letters which you remember of target word ", "Beginning Letters of Word", "For example:Data") strLength = InputBox("Enter the letter length of the rest part of target word which you don't remember", "Number of Letter Length", "For example:5,7") With Selection .HomeKey Unit:=wdStory Selection.Find.ClearFormatting With Selection.Find .Text = "<" & strStartWord & "[a-zA-Z]{" & strLength & "}>" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True .Execute End With Do While .Find.Found Set objRange = Selection.Range objRange.HighlightColorIndex = wdYellow .Collapse wdCollapseEnd .Find.Execute Loop End With End Sub
- Then hit “F5” to run the macro.
- In the first input box popping up, enter the beginning letters of target word and click “OK” to proceed.
- And in the second box, input the number of letter length and click “OK”. Use comma to separate numbers.
Finally, all found words will be highlighted in yellow.
Fix Word Issues
More often than not, various issues are likely to occur in Word. Some severe ones can even lead to the collapse of the software. And a corrupt word can result in loss of valuable data. Therefore, you must take immediate actions once a problem appears.
Author Introduction:
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including excel corruption and pdf repair software products. For more information visit www.datanumen.com