Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Star Lounger
    Join Date
    Apr 2003
    Location
    Kansas City, Missouri
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Determining the version a document is saved in (ALL)

    Hello, I am trying to find an easy way to determine what version a document is saved in. I know how to do this using Notepad. I open the Word document in Notepad and do a search for "Microsoft Word." I can find embedded in the garbage, "Microsoft Word 9.0," so that I know that the document was last saved in Word 2000.

    I intend to write a macro which examines each Word document in a folder and generates a report as to what application version each document was saved in. However, I thought I'd check first for any hints or gotchas I should be aware of. Or if there is even something simpler which I am overlooking.

    Thanks for any insight.
    Kevin

  2. #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

    Re: Determining the version a document is saved in (ALL)

    A long time ago, someone posted a very clever and roundabout way to do this. It involve scraping the information out of an obscure dialog, perhaps Insert>Object. It would take a few searches (and a bit of luck) to track it down, but I think it gave reliable results, unlike most other things discussed in that thread.

  3. #3
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determining the version a document is saved in (ALL)

    Jefferson is very clever - he always gives just sufficient information to whet your appetite enough to go out and do it. <img src=/S/grin.gif border=0 alt=grin width=15 height=15> Taking the bait, I found this in the VBA help file:

    SaveFormat Property
    Returns the file format of the specified document or file converter. Can be a unique number that specifies an external file converter, or one of the following WdSaveFormat constants: wdFormatDocument, wdFormatDOSText, wdFormatDOSTextLineBreaks, wdFormatEncodedText, wdFormatHTML, wdFormatRTF, wdFormatTemplate, wdFormatText, wdFormatTextLineBreaks, or wdFormatUnicodeText. Read-only Long.

    This sample macro might be of some use:<pre>Public Sub SavedAs()
    Dim msgFormats
    MsgBox "This document saved in format: " & ActiveDocument.SaveFormat
    For Each fc In FileConverters
    If fc.CanSave = True Then _
    msgFormats = msgFormats & fc.SaveFormat & vbTab & fc.FormatName & vbCr
    Next fc
    MsgBox msgFormats

    End Sub
    </pre>


    I can't fathom all the number/ format correlations and you'd have to work out how to apply this code to other (open) documents.
    Somebody might be able to suggest how to loop through a folder in the manner you'd like.

    Alan

  4. #4
    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: Determining the version a document is saved in (ALL)

    No... that would be far too logical. The code I'm thinking of was along the lines of this thread, although I think there is another thread that I posted in (it was not easy to find in a search, sadly). It goes more or less like this:

    With Dialogs(wdDialogInsertObject)
    .FileName = strFileName
    .tab = 1
    .Display 1
    strFileClass = .Class
    End With
    MsgBox "Class of " & strFileName & vbCrLf & "is " & strFileClass

    Hope this helps.....

  5. #5
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determining the version a document is saved in (ALL)

    Having a deeper dig (this has me restlessly curious for some reason) it looks like this code will do it for the active document:
    MsgBox ActiveDocument.BuiltInDocumentProperties(wdPropert yAppName)

    The index value of the constant wdPropertyAppName is 9. But it would be nice to be able to get to this information without actually opening a document. I can't find any mention of being able to do so, through VBS for instance.

    Alan

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

    Re: Determining the version a document is saved in (ALL)

    I fear that BuiltInDocumentProperties(wdPropertyAppName) returns the name/version used to open the document, not that used to create the document. I dug up an archived document from 1999, created in Word 97 and never modified since. BuiltInDocumentProperties(wdPropertyAppName) returns Microsoft Word 10.0, i.e. Word 2002 aka XP.

    By the way, there is a way to retrieve document properties (both built in and custom properties) without opening the document. See Dsofile.exe Lets You Edit Office Document Properties from Visual Basic and ASP.

  7. #7
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determining the version a document is saved in (ALL)

    I fear you are right. <img src=/S/sad.gif border=0 alt=sad width=15 height=15> My bad... I must admit I didn't test this.

    Alan

  8. #8
    Star Lounger
    Join Date
    Apr 2003
    Location
    Kansas City, Missouri
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determining the version a document is saved in (ALL)

    "By the way, there is a way to retrieve document properties (both built in and custom properties) without opening the document."

    But I take it that you cannot glean the version of Word used to create the document? I know that I cannot find that information just through File|Properties. And even if I could, I would imagine it has the same problem as BuiltInDocumentProperties(wdPropertyAppName).

    Kevin

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

    Re: Determining the version a document is saved in (ALL)

    No, I don't know of a way to determine which version was used to create the document. Sorry...

  10. #10
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determining the version a document is saved in (ALL)

    If you are just interested in docs created in older versions, another way might be through the compatibility options:
    <pre>With Dialogs(wdDialogToolsOptionsCompatibility)
    MsgBox .Product
    End With
    </pre>

    Usually, if you open a doc that was created in a previous version, the compatibility options will be set to that version.

    Not 100% sure how reliable that is, but it would be simple enough.
    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

  11. #11
    New Lounger
    Join Date
    Nov 2003
    Location
    Springfield, Virginia, USA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determining the version a document is saved in (ALL)

    I don't know if this will help or not, but in Windows 2000, if I use Windows Explorer to look at the file Properties, the Advanced Summary page shows the Application Name of Microsoft Word 9.0 for those files I created in Word 2000 and Microsoft Word 8.0 for those files I created in Word 97. Could this be used to quickly determine the curent version of Word used for the last save of a document without having to open the document?

  12. #12
    Star Lounger
    Join Date
    Apr 2003
    Location
    Kansas City, Missouri
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determining the version a document is saved in (ALL)

    "I don't know if this will help or not, but in Windows 2000, if I use Windows Explorer to look at the file Properties, the Advanced Summary page shows the..."

    Sadly, I'm working in NT, and it seems the Properties info does not include this. It just says Word. We will be moving to Windows XP eventually, but that won't help me at the moment.

    Okay, so it looks to me like I need to create a macro to open each document in a folder in Notepad and search out "Microsoft Word X.x"
    If I understand correctly, I can do this by opening each file in the with format = wdOpenFormatText. This may be a feasible workaround.

    And if I have trouble opening .doc as text files, you'll see me in the VBA forum. *grin*

    Thanks for all your help.

    Kevin

  13. #13
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determining the version a document is saved in (ALL)

    I'm actually beginning to question the value of this exercise. I dug up some old Word 6 and Winword 2 documents, and Office 2000 simply hung trying to open or insert them. If there's no backward compatibility here, even for reading, it would seem a pointless pursuit trying to find out version information for older documents.

    Alan

  14. #14
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determining the version a document is saved in (ALL)

    Hi Alan:
    I've had no trouble opening Word 6 docs with Word 2000. There is backward compatibility. I'm afraid I don't go back far enough to Word 2. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  15. #15
    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: Determining the version a document is saved in (ALL)

    <P ID="edit" class=small>(Edited by jscher2000 on 19-Feb-04 23:39. Perhaps not as helpful as I thought...)</P>If you are going to "random access" the files, consider using VBScript's TextStream object and related methods. Older, non-Unicode documents might be easier than newer, Unicode-based document. Hmmm...

    Added: Upon further review, it appears that the textual statement I was seeing in the file doesn't tell you the version of the application used to save the file. Probably it's just a bit in the header...
    Attached Images Attached Images

Page 1 of 2 12 LastLast

Posting Permissions

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