Undocumented VBS for testing format of file imported into Word

Author Message
emendelson

  • Total Posts : 21
  • Scores: 0
  • Reward points : 0
  • Joined: 11/4/2009
  • Status: offline
Undocumented VBS for testing format of file imported into Word Tuesday, January 05, 2010 2:01 PM (permalink)
0
There's an undocumented VBS command that returns the original file format of a document that has been imported into Word - for example, a WordPerfect 6 or 5.x file. I believe this only works when the file has been imported into Word but has not yet been saved in Word format. It seems to work under Word 2003, 2007, and 2010 beta, but doesn't work in 2002 or earlier, and may or may not work in future versions. I'm posting this here because other people might find it useful.

The command is:

WordBasic.FileVersion

I use it in a WSH script that converts WordPerfect files into Word format:

http://dl.dropbox.com/u/271144/wp2msw.vbs

The script is a mess of spaghetti code and mistakes, but it seems to work. I use this undocumented command to test whether or not the input file is a WordPerfect file, and that part seems to work reasonably well.
 
#1
    rasimmer

    • Total Posts : 2363
    • Scores: 163
    • Reward points : 0
    • Joined: 3/19/2009
    • Location: Cedar Rapids, IA
    • Status: offline
    Re:Undocumented VBS for testing format of file imported into Word Wednesday, January 06, 2010 2:16 AM (permalink)
    0
    You posted in a discussion\forum area, there is a section on the site dedicated to script sharing.  Hopefully one of the admins will see this and move it.
     
    #2
      ebgreen

      • Total Posts : 8227
      • Scores: 98
      • Reward points : 0
      • Joined: 7/12/2005
      • Status: offline
      Re:Undocumented VBS for testing format of file imported into Word Wednesday, January 06, 2010 3:57 AM (permalink)
      0
      So I don't know if I would call it undocumented so much as no longer documented. The WordBasic property returns an object that holds all of the old WordBasic commands. WordBasic was the automation language before Visual Basic for Applications (VBA) was created. VBA came out with Word 97. So it is documented. Just in documents long since turned to dust.
      "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
      Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
      http://www.visualbasicscript.com/m_47117/tm.htm
       
      #3
        emendelson

        • Total Posts : 21
        • Scores: 0
        • Reward points : 0
        • Joined: 11/4/2009
        • Status: offline
        Re:Undocumented VBS for testing format of file imported into Word Wednesday, January 06, 2010 12:43 PM (permalink)
        0
        ebgreen
        So I don't know if I would call it undocumented so much as no longer documented. The WordBasic property returns an object that holds all of the old WordBasic commands. WordBasic was the automation language before Visual Basic for Applications (VBA) was created. VBA came out with Word 97. So it is documented. Just in documents long since turned to dust.


        In this case, it really is undocumented. .FileVersion was not part of the original set of WordBasic commands. I've been told (reliably but privately) that it was introduced in Word 2003 for internal use by Microsoft. You can find the WordBasic help file here and, as you see, it isn't included. And, if you try it out in Word 6.0, it generates an error.

         
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9