Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detect what version (if any) of Excel is installed
I am looking for a way (maybe something in the registry?) to determine what version, if any, of Excel is installed on a PC. I would like it to work regardless of whether Excel was installed as a standalone app or with any of the various Office editions
Thanks very much. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detect what version (if any) of Excel is installed
Hi Keith,
Use application.version -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Keith Brautigam" wrote in message ... I am looking for a way (maybe something in the registry?) to determine what version, if any, of Excel is installed on a PC. I would like it to work regardless of whether Excel was installed as a standalone app or with any of the various Office editions. Thanks very much. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detect what version (if any) of Excel is installed
Thanks Bob
Actually I should have been clearer -- and maybe this is the wrong newsgroup for my question. The situation is that I have a C++/MFC app and I want to detect the Excel version from it Thanks. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detect what version (if any) of Excel is installed
"Bob Phillips" wrote...
Use application.version ... Kinda Chicken & Egg-ish. If there's no version of Excel at all, there's no way to execute this statement. Check whether Excel exists at all could be done by searching for EXCEL.EXE. -- To top-post is human, to bottom-post and snip is sublime. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detect what version (if any) of Excel is installed
or trying to create an instance. I guess that would fail if Excel wasn't
present. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Harlan Grove" wrote in message ... "Bob Phillips" wrote... Use application.version .. Kinda Chicken & Egg-ish. If there's no version of Excel at all, there's no way to execute this statement. Check whether Excel exists at all could be done by searching for EXCEL.EXE. -- To top-post is human, to bottom-post and snip is sublime. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detect what version (if any) of Excel is installed
Check whether Excel exists at all could be done by searching for EXCEL.EXE. Rather than a slow file search for Excel.exe, it would be much faster to use FindExecutable to find the program that is associated with the 'xls' file extension. Declare Function GetTempFileName Lib "kernel32" _ Alias "GetTempFileNameA" ( _ ByVal lpszPath As String, _ ByVal lpPrefixString As String, _ ByVal wUnique As Long, _ ByVal lpTempFileName As String) As Long Declare Function FindExecutable Lib "shell32.dll" _ Alias "FindExecutableA" ( _ ByVal lpFile As String, _ ByVal lpDirectory As String, _ ByVal lpResult As String) As Long Sub AAA() Dim FName As String Dim FNum As String Dim ExeName As String Dim Res As Long FName = String$(255, " ") ExeName = String$(255, " ") Res = GetTempFileName(CurDir, "", 0&, FName) FName = Application.Trim(FName) Mid$(FName, Len(FName) - 2, 3) = "xls" FNum = FreeFile Open FName For Output As #FNum Close #FNum Res = FindExecutable(FName, vbNullString, ExeName) Kill FName If Res 32 Then ' association found ExeName = Left$(ExeName, InStr(ExeName, Chr(0)) - 1) Else ' no association found ExeName = "" End If MsgBox "Excel is: " & ExeName End Sub This won't tell you what version of Excel is found (that would call for a variety of registry calls) but would indicate that some version of Excel is installed. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Harlan Grove" wrote in message ... "Bob Phillips" wrote... Use application.version .. Kinda Chicken & Egg-ish. If there's no version of Excel at all, there's no way to execute this statement. Check whether Excel exists at all could be done by searching for EXCEL.EXE. -- To top-post is human, to bottom-post and snip is sublime. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detect what version (if any) of Excel is installed
Hi Keith,
You can try to create a new object based on the class "Excel.Application". That should return the latest version of Excel installed on the user's machine. Next, check the Version property of the Application object to see what version it is. If the user doesn't have Excel installed, you'll get a runtime error (maybe 429) when you try to instantiate the object. In VB, it would look something like this: Public Function gsGetXLVersion() As String Dim xlApp As Object On Error GoTo ErrHandler Set xlApp = CreateObject("Excel.Application") gsGetXLVersion = xlApp.Version ExitRoutine: If Not xlApp Is Nothing Then xlApp.Quit Set xlApp = Nothing End If Exit Function ErrHandler: Resume ExitRoutine End Function The function will return an empty string if Excel is not installed. If it is, it will return a string representing the version number. You can take anything before the decimal separator to get the version number. XL95 returns "7.x", 97 returns "8x", 2000 returns "9.x", 2002 returns "10.x", and 2003 returns "11.x". -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Keith Brautigam wrote: I am looking for a way (maybe something in the registry?) to determine what version, if any, of Excel is installed on a PC. I would like it to work regardless of whether Excel was installed as a standalone app or with any of the various Office editions. Thanks very much. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I save an Excel 97-2003 version or 2007 version for Mac 200 | Excel Discussion (Misc queries) | |||
Fill color not functioning in newly installed version of excel. | Excel Worksheet Functions | |||
HELP: how to detect if printers are installed? woes :S | Excel Worksheet Functions | |||
Recover earlier version of excel sheet after new version saved? | Excel Discussion (Misc queries) | |||
Detect Excel Version | Excel Programming |