FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Which Office version
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Which Office version
Posted: 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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Which Office version
Posted: Tue Jun 02, 2009 12:57 PM
Hello Michel,
I use this code:

regards,
Otto
Code (fw): Select all Collapse
    oWord := CREATEOBJECT( "Word.Application" )
      
Msginfo(oword:Version) 

//12 = WORD 2007
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Which Office version
Posted: Tue Jun 02, 2009 01:15 PM

Otto,

Thanks a lot for your help.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Which Office version
Posted: Tue Jun 02, 2009 01: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 :


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 (fw): Select all Collapse
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 :-)
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.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Which Office version
Posted: Tue Jun 02, 2009 03: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 (fw): Select all Collapse
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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Which Office version
Posted: Tue Jun 02, 2009 06: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Continue the discussion