Jump to content
Sign in to follow this  
ScriptUSER

Checking if word is installed

Recommended Posts

ScriptUSER

I am using th following script to identify if Msword is installed on a users computer .

There are differnt versions of Word like 9 , 10 , 11 ....

my code checks for vesion 10 and works if i subsiute 11 works for vr 11 .

how could i modify my code to work for all versions , without additional scipting ?

CODE
$sPath = RegRead("HKLM\SOFTWARE\Microsoft\Office\10.0\Word\InstallRoot", "Path")

If @error Then

;MsgBox(48, "Error", "MS Office 2002 is not installed.")

ColorDemo5()

Exit

EndIf

Share this post


Link to post
Share on other sites
ChrisL

Try this

Local $objWord = ObjCreate("Word.Application")

If IsObj($objWord) then 
Msgbox (0,"","Version: " & $objWord.Caption & " " & $objWord.Version & @crlf _
                & "Build: " & $objWord.Build)
$objWord.Quit
Else
    Msgbox (0,"","Word is not installed")
EndIf

Share this post


Link to post
Share on other sites
alc

Hi

ChrisL's code works indeed, but ensure you close the Word instance as soon as posible: if outside your script (you manually or another app) opens another instance of Word, the line:

$objWord.Quit

will close this second instance.

If all you need is to know if Word is installed, then I suggest:

RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\winword.exe\Path")

Bye

alc

Share this post


Link to post
Share on other sites
sensalim

RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\winword.exe\Path")

I think you mean

RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\winword.exe","Path")

since it requires 2 parameters.

Thanks for the code, I needed it.

Share this post


Link to post
Share on other sites
alc

@ sensalim:

Hi.

You are right about the two parameters, I just copied-pasted from another language, without checking. Sorry

Glad to help. Bye

alc

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.