Quote:
Originally Posted by Stephen Ray
Here is a Macro that loops until the end of the document.
...
If that highlighted Paragraph Mark is also the last Paragraph Mark in the document, BINGO!
|
What does that achieve the you don't get with:
Code:
Sub ParagraphCount()
MsgBox ActiveDocument.Paragraphs.Count
End Sub
or:
Code:
Sub ParagraphCount()
MsgBox ActiveDocument.ComputeStatistics(wdStatisticParagraphs)
End Sub
without:
• all the flickering;
• messing with the selected range;
• the overhead of a loop; and
• having to insert a quite arbitrary exit point to overcome your code's propensity for locking up Word?
Furthermore, your code doesn't handle tables correctly.
Moreover, since you haven't defined what 'counter' is, that:
• can result in complier errors (i.e. if one uses 'Option Explicit', which is always good practice); and
• results in an variant, which is less efficient to use than if it was properly defined it as a long.
PS: When posting code, please use the code tags, indicated by the # button on the posting menu. Without them, your code loses much of whatever structure it had.