Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tell which version of Office (or Word) is installed 2

Status
Not open for further replies.

wtotten

IS-IT--Management
Apr 10, 2002
181
US
I'm using VFP 8. is there a way to determine which version of Office (or Word) is installed (e.g., 2003, 2007, 2010, 2013, 2016)?

Thanks,
Bill
 
Well,

1. The Office Application COM Automation Servers (ie Word.Applicatiom, Excel.Application, Outlook.Application) have a Version property.
2. Registry is telling about installed software and Version

Ad 1:

Code:
Try
 o = CreateObject("Word.Application")
 ? o.Version
Catch
 ? "Word is not installed (properly)"
EndTry

Ad 2:
a) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinWord.exe contains the path to Windword.EXE and you can use AGETFILEVERSION() on it
b) HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products lists all installed products

Code:
Clear

Local Array laProductKeys[2]
Local lcProduct
loReg = NewObject("registry",_Samples+"classes\registry.prg")
If loReg.EnumOptions(@laProductKeys,"SOFTWARE\Classes\Installer\Products",-2147483646,.T.) = 0
   For Each lcProductKey In laProductKeys
      If loReg.GetRegKey("ProductName",@lcProduct,"SOFTWARE\Classes\Installer\Products\"+lcProductKey+"\",-2147483646) = 0
         ? lcProduct
      Else
         ? "No Product name for Prodcuct Key ",lcProductKey
      Endif
   EndFor
Else
   ? "No Product Enumeration Found"
Endif

Bye, Olaf.
 
If you open the application using automation...
Code:
			OWORD = CREATEOBJECT("Word.Application")
			MESSAGEBOX(OWORD.application.version)

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Thanks guys. That's what I was looking for.
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top