how to add a running word count

  • Follow


i want to add a running word count at the end of every page on my essay and 
is it able to do it automatically? i am using Microsoft Word 2007
0
Reply Utf 1/2/2010 5:37:01 PM

You cannot do it automatically.  However, if you run a macro containing the 
following code when your document is the active document, it will create a 
new document with each page of your document in a separate Section and with 
the running word count in the footer of each Section.

Dim Counter As Long, i As Long
Dim Source As Document, Target As Document
Dim rngTarget As Range
Dim strPages As String
Dim arrPagee As Variant
Set Source = ActiveDocument
Set Target = Documents.Add
Source.Activate
Selection.HomeKey Unit:=wdStory
Pages = Source.BuiltInDocumentProperties(wdPropertyPages)
Counter = 0
strPages = ""
While Counter < Pages
    Counter = Counter + 1
    With Source.Bookmarks("\Page").Range
        strPages = strPages & "|" & .Words.Count
        .Copy
    End With
    Set rngTarget = Target.Range
    rngTarget.Collapse wdCollapseEnd
    rngTarget.Paste
    Set rngTarget = Target.Range
    rngTarget.Collapse wdCollapseEnd
    rngTarget.InsertBreak wdSectionBreakNextPage
    Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Count:=1
Wend
arrPages = Split(strPages, "|")
Counter = 0
With Target
    For i = 1 To .Sections.Count - 1
        With .Sections(i).Footers(wdHeaderFooterPrimary)
            .LinkToPrevious = False
            Counter = Counter + Val(arrPages(i))
            .Range.Text = Counter
        End With
    Next i
End With


-- 
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Shejju" <Shejju@discussions.microsoft.com> wrote in message 
news:02E60059-BA57-4A44-8FE3-6E5567BC757C@microsoft.com...
> i want to add a running word count at the end of every page on my essay 
> and
> is it able to do it automatically? i am using Microsoft Word 2007 

0
Reply Doug 1/2/2010 10:38:55 PM


1 Replies
1298 Views

(page loaded in 0.052 seconds)

Similiar Articles:
















7/24/2012 5:33:33 AM


Reply: