Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Help needed for Micrsoft Word Macro
Hi,
I am trying to get the word count for the inserted text using Track changes as "ON" in the word document. The text on the document i have added is "Hello world". When i am trying to get the count on macro then it is showing 1, but i have inserted two words. Please help me if you know how to get the count for the inserted text. My code is like this ********************************** Dim mySection As Section Dim iCount As Integer For Each mySection In ActiveDocument.Sections iCount = iCount + mySection.Range.Revisions.Count Next MsgBox "Count is " & iCount ********************************** Thanks Shyla |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Help needed for Micrsoft Word Macro
Hi Shyla
I'm not sure whether you just want the total number of revisions, the number of words in each revision, or the number of words in all revisions. The following code does all three, though you need to be aware that Word treats punctuation marks as words in their own right: Sub ListRevisionChanges() Dim Rev As Revision Dim RWrd As Integer RWrd = 0 MsgBox "# Revisions: " & ActiveDocument.Revisions.Count For Each Rev In ActiveDocument.Revisions MsgBox "Revision Text: " & Rev.Range.Text & vbCrLf & _ "Revision Words: " & Rev.Range.Words.Count RWrd = RWrd + Rev.Range.Words.Count Next MsgBox "# Revision Words: " & RWrd End Sub Cheers "Shyla" wrote in message oups.com... Hi, I am trying to get the word count for the inserted text using Track changes as "ON" in the word document. The text on the document i have added is "Hello world". When i am trying to get the count on macro then it is showing 1, but i have inserted two words. Please help me if you know how to get the count for the inserted text. My code is like this ********************************** Dim mySection As Section Dim iCount As Integer For Each mySection In ActiveDocument.Sections iCount = iCount + mySection.Range.Revisions.Count Next MsgBox "Count is " & iCount ********************************** Thanks Shyla |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I get rid of page numbers. The page number virus | Microsoft Word Help | |||
apply a template to existing documents | Page Layout | |||
Does Word have Keyboard Merges like Word Perfect does? | Mailmerge | |||
Macros - Keyboard Commands | Microsoft Word Help | |||
In Word, how can I see all files (*.*) in "save as"? | New Users |