Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I save an Excel 97-2003 version or 2007 version for Mac 200 Bronigal Excel Discussion (Misc queries) 1 December 7th 09 08:04 AM
Fill color not functioning in newly installed version of excel. Vernon Antoine Brou Jr. Excel Worksheet Functions 2 October 24th 06 09:55 PM
HELP: how to detect if printers are installed? woes :S KevinGPO Excel Worksheet Functions 1 March 14th 06 09:58 AM
Recover earlier version of excel sheet after new version saved? stephanie38 Excel Discussion (Misc queries) 3 June 17th 05 03:52 AM
Detect Excel Version Stacy Haskins Excel Programming 2 August 19th 03 09:55 PM


All times are GMT +1. The time now is 07:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"