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