How to determine programatically if Excel is installed
Can anybody tell me what is the best way to determine programatically from
VBA or VB6 whether Excel is installed on the current machine and, if so, what version. -- Peter |
"PeterH" wrote...
Can anybody tell me what is the best way to determine programatically from VBA or VB6 whether Excel is installed on the current machine and, if so, what version. There's always Registry scanning. Search for the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Then within this key search for the highest subkey of the form 8.0, 9.0, 10.0, 11.0 (nothing past 11.0 yet) containing an Excel\InstallRoot subkey. That'd be the newest version installed. There should also be API function calls to read version tags from .EXE or ..DLL files. You could use them to read the version tag from the Excel executable, EXCEL.EXE. |
I don't use VB6, but this worked from MSWord.
Option Explicit Sub testme() Dim myXL As Object Set myXL = Nothing On Error Resume Next Set myXL = CreateObject("Excel.Application") On Error GoTo 0 If myXL Is Nothing Then MsgBox "not installed" Else MsgBox "Yep, they have it" & vbLf & myXL.Version myXL.Quit Set myXL = Nothing End If End Sub PeterH wrote: Can anybody tell me what is the best way to determine programatically from VBA or VB6 whether Excel is installed on the current machine and, if so, what version. -- Peter -- Dave Peterson |
All times are GMT +1. The time now is 12:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com