Sign in to follow this  
Followers 0
storme

How do I work out what version of MS office is loaded?

7 posts in this topic

G'day all

I use Autopatcherto update computers when I have to bring them back to the office for repairs.

To keep everything clean I've seperated the the Operating systems and Office verions into seperate directories.

I've got the selection of the Operating system (XP/Vista 32/64 SP?) setup.

What I can't work out is an easy way to work out what version of Office (XP, 2003, 2007) is loaded on the system.

Anyone point me in the right direction?

Thanks in advance

John Morrison

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

G'day all

I use Autopatcherto update computers when I have to bring them back to the office for repairs.

To keep everything clean I've seperated the the Operating systems and Office verions into seperate directories.

I've got the selection of the Operating system (XP/Vista 32/64 SP?) setup.

What I can't work out is an easy way to work out what version of Office (XP, 2003, 2007) is loaded on the system.

Anyone point me in the right direction?

Thanks in advance

John Morrison

The function _Word_VersionInfo() in the Word.au3 UDF might be of use.

I think it's a safe assumption that any MS Office installation will at least include MS Word.

Edited by Spiff59

Share this post


Link to post
Share on other sites

The function _Word_VersionInfo() in the Word.au3 UDF might be of use.

I think it's a safe assumption that any MS Office installation will at least include MS Word.

Looks like that only returns the version of the UDF

Returns an array of information about the Word.au3 version

I ran the test code

#include <Word.au3>
$aVersion = _Word_VersionInfo ()
ConsoleWrite("Word.au3 Version " & $aVersion[5] & " released " & $aVersion[4])

and it gave me this

Word.au3 Version V1.0-1 released 20070414

Thanks for the help and it was a great bit of lateral thinking.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Looks like that only returns the version of the UDF

I ran the test code

#include <Word.au3>
$aVersion = _Word_VersionInfo ()
ConsoleWrite("Word.au3 Version " & $aVersion[5] & " released " & $aVersion[4])

and it gave me this

Thanks for the help and it was a great bit of lateral thinking.

Wow, that's not at all what I'd of thought _Word_VersionInfo does. Not a very useful function. This seems to work:

$objWord = ObjCreate("Word.Application")
MsgBox(1,"", $objWord.Version & " or " & $objWord.Build) ; short and long version info
$objWord.Quit

Edit: Of course an "If IsObj($ObjWord)" test after the ObjCreate might be prudent in case you run into machines where Word/Office haven't been installed.

Edited by Spiff59

Share this post


Link to post
Share on other sites

Wow, that's not at all what I'd of thought _Word_VersionInfo does. Not a very useful function. This seems to work:

$objWord = ObjCreate("Word.Application")
MsgBox(1,"", $objWord.Version & " or " & $objWord.Build) ; short and long version info
$objWord.Quit

THANKS HEAPS!!!

That is exactly what I needed. I did a little extra research and found what the numbers mean so maybe someone will find this usefull.

$objWord = ObjCreate("Word.Application")
$OfficeVerison = $objWord.Version
$objWord.Quit

Switch $OfficeVerison
    Case "7.0"
        $OfficeVerison = "97"
    Case "8.0"
        $OfficeVerison = "98"
    Case "9.0"
        $OfficeVerison = "2000"
    Case "10.0"
        $OfficeVerison = "2002"
    Case "11.0"
        $OfficeVerison = "2003"
    Case "12.0"
        $OfficeVerison = "2007"
    Case "14.0"
        $OfficeVerison = "2010"
    Case Else
        $OfficeVerison = "Too Old!"
EndSwitch

MsgBox(0,"Office Verison", "Your office Verison is " & $OfficeVerison)

As you siad Word is always part of office so look for the "tree" and we know what "forest" we're in. :(

Thanks

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

THANKS HEAPS!!!

That is exactly what I needed. I did a little extra research and found what the numbers mean so maybe someone will find this usefull.

$objWord = ObjCreate("Word.Application")
$OfficeVerison = $objWord.Version
$objWord.Quit

Switch $OfficeVerison
    Case "7.0"
        $OfficeVerison = "97"
    Case "8.0"
        $OfficeVerison = "98"
    Case "9.0"
        $OfficeVerison = "2000"
    Case "10.0"
        $OfficeVerison = "2002"
    Case "11.0"
        $OfficeVerison = "2003"
    Case "12.0"
        $OfficeVerison = "2007"
    Case "14.0"
        $OfficeVerison = "2010"
    Case Else
        $OfficeVerison = "Too Old!"
EndSwitch

MsgBox(0,"Office Verison", "Your office Verison is " & $OfficeVerison)

As you siad Word is always part of office so look for the "tree" and we know what "forest" we're in. :(

Thanks

You're welcome. What? Microsoft is superstitious? They skipped version 13? lol

I think the script might explode if you run across a machine with no version of Word installed, you might want to test if the ObjCreate() worked, soemthing like:

$objWord = ObjCreate("Word.Application")
If IsObj($objWord) Then
    $OfficeVerison = $objWord.Version
    $objWord.Quit
Else 
    $OfficeVerison = "N/A"
EndIf

Switch $OfficeVerison
    Case "7.0"
        $OfficeVerison = "97"
    Case "8.0"
        $OfficeVerison = "98"
    Case "9.0"
        $OfficeVerison = "2000"
    Case "10.0"
        $OfficeVerison = "2002"
    Case "11.0"
        $OfficeVerison = "2003"
    Case "12.0"
        $OfficeVerison = "2007"
    Case "14.0"
        $OfficeVerison = "2010"
    Case "N/A"
        $OfficeVerison = "Not Installed"
    Case Else
        $OfficeVerison = "Too Old!"
EndSwitch

MsgBox(0,"Office Verison", "Your office Verison is: " & $OfficeVerison)

You prolly wanna replace all the "verison" with "version" as well :)

Edited by Spiff59

Share this post


Link to post
Share on other sites

Thanks again.

I was going to add the error checking when I added the rest of the code to do the updates (tomorrow).

But it's easier to just cut and paste yours. :(

When I get teh script beat into shape I'll drop it into the example forum. Someone may find it usefull.

Have a great weekend!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0