Sometimes, we need to find a text in a document appear in the total number of times, that is, the total number to find the text, for example, in a discipline to find a name registration form is the total number of records, there are many similar applications . But Word is not such a function, I wrote a macro, so that a single text in Word has a total number of statistical functions. Here implementation.
The first step click Word menu [Tools] → [macro] → [Wang], enter the macro name "FindText", then click [Create] button.
The second step in the pop-up window VisualBasic code editor to complete the following:
Sub FindText ()
Text = InputBox ("Please enter the text you want to find: ", "prompt")
With ActiveDocument.Content.Find
Do While. Execute (FindText: = Text) = True
tim = tim 1
Loop
End With
MsgBox ("Find the current document to"Str (tim)"a"Text), 48,"complete "
End Sub
After the third step entry, click the menu [File] → [after the close and return to the Micrcsoft Word].
Step-click menu [Tools] → [Custom], click the "order" tab in the "Category " select "macro ", the right of the "Normal.NewMacros.FindText" command drag the "Edit" Menu, and right-drag command, in the "name" box, rename it to "look for the amount of text" (pictured).
After the text to the number of statistics, just click the [Edit] → [find text number], follow the prompts to enter looking for, click [OK] to get results.
没有评论:
发表评论