Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Can anybody tell me how to pick up the document stats, creation date, last modified date etc within a word macro please.

    Regards

    Mike

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by mikeyt View Post
    Can anybody tell me how to pick up the document stats, creation date, last modified date etc within a word macro please.
    What kinds of statistics? Try these (you can explore further parameters in the help and object browser):

    Code:
    msgbox activedocument.ComputeStatistics(wdStatisticWords)
    msgbox activedocument.BuiltInDocumentProperties(wdpropertytimecreated)

  4. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,894
    Thanks
    0
    Thanked 188 Times in 172 Posts
    Hi Mike,

    Many stats can also be retrieved via fields. For example: CREATEDATE, PRINTDATE, SAVEDATE, NUMWORDS, FILESIZE, AUTHOR, etc, etc. Check out Insert|Field. The DOCPROPERTY field has numerous options too.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. #4
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jscher2000 View Post
    What kinds of statistics? Try these (you can explore further parameters in the help and object browser):

    Code:
    msgbox activedocument.ComputeStatistics(wdStatisticWords)
    msgbox activedocument.BuiltInDocumentProperties(wdpropertytimecreated)
    Thanks.... this will do fine

  6. #5
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    2,827
    Thanks
    19
    Thanked 109 Times in 103 Posts
    Beware that the only meaningful file date&time field is the File Modified/Changed Date/Time.

    See this ancient but still relevant XXCOPY technical article.
    BATcher

    Dear Diary, today the Hundred Years War started ...

  7. #6
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,894
    Thanks
    0
    Thanked 188 Times in 172 Posts
    Quote Originally Posted by BATcher View Post
    Beware that the only meaningful file date&time field is the File Modified/Changed Date/Time.
    Hi BATcher,

    I disagree - strongly. The data returned by Word from the document metadata has little to do with the File Modified/Changed Date/Time recorded by the operating system and represents the document's history as distinct from the file's history. The document creation date, for example, reflects the date the document was created (or last saved using File|Save As), which can be much earlier than any date recorded by the operating system - simply because the document was created on a different system before being copied to the one on which it is now stored. Ditto the saved date.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  8. #7
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    2,827
    Thanks
    19
    Thanked 109 Times in 103 Posts
    My error is to assume that Word is obtaining its date information from the file system. Put it down to pure ignorance!
    BATcher

    Dear Diary, today the Hundred Years War started ...

Posting Permissions

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