Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Park City, Utah
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Get Character Count (Word 2003)

    Is it possible to retrieve the document statistics programmatically? I need to get the paragraph (hard returns) count and add that to the characters with spaces count in a word document which will give me a fairly accurate character count of the body of the document. Or, if all the text in the document is highlighted, is there something that returns the characters contained in the highlighted text?

    Thanks!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Get Character Count (Word 2003)

    ActiveDocument.BuiltInDocumentProperties(property) returns various statistics.

    With wdPropertyCharacters as property, you get the number of characters.
    wdPropertyCharsWSpaces yield the number of characters with spaces.
    wdPropertyLines results in the number of lines.
    wdPropertyParas produces the number of paragraphs.
    wdPropertyWords yields the number of words.

    There are other properties. See the Object Browser (press F2 in the Visual Basic Editor) and type WdBuiltInProperty in the Search box.

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Get Character Count (Word 2003)

    As a late footnote, some of the statistics also are available via the document.ComputeStatistics and range.ComputeStatistics methods. Note that this might change the Saved property from True (no changes to be saved) to False (some changes to be saved).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •