Which Office version

Which Office version

Postby driessen » Tue Jun 02, 2009 12:48 pm

Hello,

How can I check in FWH which office version is installed or is active on my computer ?

Thanks a lot in advance.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Which Office version

Postby Otto » Tue Jun 02, 2009 12:57 pm

Hello Michel,
I use this code:

regards,
Otto
Code: Select all  Expand view

    oWord := CREATEOBJECT( "Word.Application" )
     
Msginfo(oword:Version)

//12 = WORD 2007

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: Which Office version

Postby driessen » Tue Jun 02, 2009 1:15 pm

Otto,

Thanks a lot for your help.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Which Office version

Postby ukoenig » Tue Jun 02, 2009 1:27 pm

Another quick detailed info :

Maybe You need the real version-numbers of the installed MS-Office ( not product-name like Word 2007 )
Reads from Registry :
Image

Save this as < CheckOffice.vbs > A dbl-click on this file shows the versions.
Also You can call it from inside Your application. Winexec('WSCRIPT.exe CheckOffice.VBS')

Code: Select all  Expand view

Dim WSHShell, objFSO, textout
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WSHShell = CreateObject("WScript.Shell")

Dim part(4,1)
 part(0,0) = "Word"       : part(1,1) = "WINWORD.EXE"
 part(1,0) = "Excel"      : part(2,1) = "EXCEL.EXE"
 part(2,0) = "Outlook"    : part(4,1) = "OUTLOOK.EXE"
 part(3,0) = "PowerPoint" : part(0,1) = "POWERPNT.EXE"
 part(4,0) = "Access"     : part(3,1) = "MSACCESS.EXE"

textout = "Installed Office-Applications :" & vbCRLF & vbCRLF

Call ChkOffice("11.0","2003")
Call ChkOffice("10.0","XP")
Call ChkOffice("9.0", "2000")
Call ChkOffice("8.0", "97")

MsgBox textout,64,"CheckOffice.vbs"

Function ChkOffice(ver, verfull)
 Dim pfad, res, helptext

 On Error Resume Next
 pfad = "HKLM\Software\Microsoft\Office\" & ver & "\Common\InstallRoot\Path"
 res = WSHShell.RegRead(pfad)
 If res <> "
" Then
  For i = 0 to 4
   If objFSO.FileExists(res&part(i,1)) Then
    helptext = part(i,0) & Space(1) & verfull & "
 (" & objFSO.GetFileVersion(res&part(i,1))&")"
    textout = textout & helptext & vbCRLF
   End If
  Next
  textout = textout & vbCRLF
 End If

End Function


Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Which Office version

Postby nageswaragunupudi » Tue Jun 02, 2009 3:19 pm

While I like the simplicity of Mr Otto's logic, here is another version, if we want to read the version from Windows Registry
Code: Select all  Expand view
static function MSOfficeVer()

   local oReg, nVer := 0

   oReg  := TReg32():New( HKEY_LOCAL_MACHINE, ;
              "SOFTWARE\Microsoft\Office\Common" )
   nVer  := oReg:Get( 'LastAccessInstall', nVer )
   oReg:Close()


return nVer
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Which Office version

Postby driessen » Tue Jun 02, 2009 6:19 pm

Guys,

Thanks a lot for your help.

I'm very greatful to you all.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 98 guests