That's it! I hope you have found this Microsoft Word Help & Tips page useful and informative. If so we copy the iterator to the local variable mostcommon, so we have a record of both the most commonly seen word so far and its count.
We show you how to find the word count on Microsoft Word, as well as how to count characters, for both your entire document and specific sections of text. As we update the count, we check if that makes the word the most-common word seen so far. For more dummy text methods see Word MVP Suzanne Barnhill's: Dummy Text WinBuzzer Tips How to Check the Word Count in Microsoft Word and Word Online. " text in Word 2007/2010 by simply typing =lorem() and pressing enter.
See: Installing Macros for instructions on how to set up and use the macros provided in this Microsoft Word Help & Microsoft Word Tips page.īonus Tip: Create your own "Lorem ipsum. MsgBox "There are " & LineCount & " qualified lines in this document" TCount = ActiveDocument.ComputeStatistics(wdStatisticLines) & "To be counted the line must contain the " _ Qualifier = InputBox("Enter threshold line length." & vbCr + vbCr _ For example, if you want to count all lines containing three or more characters (excluding the paragraph mark or line break mark) then you enter 3 in the input box when the macro runs. It is pre-set to skip counting lines that contain a single character (i.e., a paragraph mark or line break mark) and lets you specify a threshold qualifier. Makes 1 line out of 4 and improves readability quite a bit. dict.get (key, default) checks for the key in dict and returns default in case key is not in dict. The second macro counts lines of qualified length. In addition to hjpotter92 s answer you can improve your counting using dict.get () for word in cleanedwords: wordcounter word wordcounter.get (word, 0) + 1.MsgBox ("The document contains " & NumLines & " Lines") Then on the Tools menu, click Word Count. To count the number of words in only part of your document, select the text you want to count. Count the number of words in a part of a document. NumLines = ActiveDocument.ComputeStatistics(wdStatisticLines) Unless you have selected some text, Word counts all text in the document, as well as the characters, and displays them in the Word Count box as the Statistics.