• Determining the version a document is saved in (ALL)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Determining the version a document is saved in (ALL)

    Author
    Topic
    #401004

    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

    Viewing 4 reply threads
    Author
    Replies
    • #786788

      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.

    • #786789

      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.

    • #786974

      Jefferson is very clever – he always gives just sufficient information to whet your appetite enough to go out and do it. grin 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:

      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
      

      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

      • #786999

        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…..

        • #787076

          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(wdPropertyAppName)

          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

          • #787081

            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.

            • #787091

              I fear you are right. sad My bad… I must admit I didn’t test this.

              Alan

            • #787092

              I fear you are right. sad My bad… I must admit I didn’t test this.

              Alan

            • #787213

              “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

            • #787219

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

            • #787220

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

            • #787214

              “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

            • #787235

              If you are just interested in docs created in older versions, another way might be through the compatibility options:

              With Dialogs(wdDialogToolsOptionsCompatibility)
                MsgBox .Product
              End With
              

              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.
              cheers Klaus

            • #787585

              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

            • #787599

              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. smile

            • #787741

              Yes, taking a few more samples proves this to be right. The archived folder I was sampling from seems to contain all the “problem” documents, which were most likely conversions from WordPerfect, and which probably never converted properly in the first place. Other Word 6 and 2 .docs seem to open OK (sans macros of course).

              Alan

            • #787742

              Yes, taking a few more samples proves this to be right. The archived folder I was sampling from seems to contain all the “problem” documents, which were most likely conversions from WordPerfect, and which probably never converted properly in the first place. Other Word 6 and 2 .docs seem to open OK (sans macros of course).

              Alan

            • #787600

              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. smile

            • #787586

              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

            • #854859

              That’s not a reliable method.

              Using Word 2003, I just tried a 1997 document created by somebody else in Word 97, or earlier.
              .Product returned “Custom”.

            • #854886

              Klaus stated that it wasn’t reliable – it will only be accurate if the user has never fiddled with the compatibility settings. Unfortunately, we haven’t been able to find something better that is exposed in the object model.

            • #854887

              Klaus stated that it wasn’t reliable – it will only be accurate if the user has never fiddled with the compatibility settings. Unfortunately, we haven’t been able to find something better that is exposed in the object model.

            • #787236

              If you are just interested in docs created in older versions, another way might be through the compatibility options:

              With Dialogs(wdDialogToolsOptionsCompatibility)
                MsgBox .Product
              End With
              

              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.
              cheers Klaus

          • #787082

            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.

        • #787077

          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(wdPropertyAppName)

          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

      • #787000

        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…..

    • #787291

      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?

      • #787309

        “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

        • #787641

          (Edited by jscher2000 on 19-Feb-04 23:39. Perhaps not as helpful as I thought…)

          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…

          • #787661

            Jefferson,

            The “property” you are referring to here is the ProgID; it can also be retrieved using DSOFile (see my reply higher up in this thread). ProgID is the file type as stored in the HKEY_CLASSES_ROOT part of the Registry; starting with Word 97, this has been Word.Document.8 – there is no .9, .10 or .11 type. So this doesn’t help to distinguish the creator either. Klaus Linke’s suggestion may well be the nearest you can get.

          • #787662

            Jefferson,

            The “property” you are referring to here is the ProgID; it can also be retrieved using DSOFile (see my reply higher up in this thread). ProgID is the file type as stored in the HKEY_CLASSES_ROOT part of the Registry; starting with Word 97, this has been Word.Document.8 – there is no .9, .10 or .11 type. So this doesn’t help to distinguish the creator either. Klaus Linke’s suggestion may well be the nearest you can get.

        • #787642

          (Edited by jscher2000 on 19-Feb-04 23:39. Perhaps not as helpful as I thought…)

          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…

      • #787310

        “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

    • #787292

      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?

    Viewing 4 reply threads
    Reply To: Determining the version a document is saved in (ALL)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: