Problem with macro

  • Thread starter Thread starter jainagirl
  • Start date Start date
J

jainagirl

Hi,

How do I make this MS Word macro apply to an entire document, rather than
just a paragraph? I need it to count the number of sentences in the whole
document. I have only basic knowledge of macros and the editor, etc. Also, is
it possible to count the number of paragraphs by cloning this macro and
changing it to do that? Using Word 97. TIA. Jainagirl

Public Sub NumberOfSentences()
Dim sNumberOfSentences As Long
sNumberOfSentences = Selection.Paragraphs(1).Range.Sentences.Count
MsgBox sNumberOfSentences & " Sentences", _
vbInformation, "Number of Sentences"
End Sub
 
Public Sub NumberOfSentences()
Dim sNumberOfSentences As Long
sNumberOfSentences = ActiveDocument.Range.Sentences.Count
MsgBox sNumberOfSentences & " Sentences", _
vbInformation, "Number of Sentences"
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Jainagirl,

Do you have to use a macro? If not, tools > word count... will also give
you a count of the number of paragraphs in the entire document.

Hope this helps,
Dan
 
Hi,

Yes, I do need a sentence count as well as a word count. I'm a writer and I
often write copy for websites for clients and sometimes there is a number of
sentences requirement.

Jaina
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top