Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.vb.general.discussion,microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default How to check programmatically whether Excel is installed on computer?

I mean Excel installed, not running.


  #2   Report Post  
Posted to microsoft.public.vb.general.discussion,microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to check programmatically whether Excel is installed on computer?

The most trustworthy would be to start it with CreateObject. (or use
GetObject which would get an existing running instance if one was up).

--
Regards,
Tom Ogilvy


Jack <replyto@newsgroup wrote in message
...
I mean Excel installed, not running.




  #3   Report Post  
Posted to microsoft.public.vb.general.discussion,microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default How to check programmatically whether Excel is installed on computer?

Tom, not running theExcel instance, but the existance of the installed
program I need to check.

"Tom Ogilvy" wrote in message
...
The most trustworthy would be to start it with CreateObject. (or use
GetObject which would get an existing running instance if one was up).

--
Regards,
Tom Ogilvy


Jack <replyto@newsgroup wrote in message
...
I mean Excel installed, not running.






  #4   Report Post  
Posted to microsoft.public.vb.general.discussion,microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to check programmatically whether Excel is installed on computer?

I understand what you want. Answer is the same.

--
Regards,
Tom Ogilvy

Jack <replyto@newsgroup wrote in message
...
Tom, not running theExcel instance, but the existance of the installed
program I need to check.

"Tom Ogilvy" wrote in message
...
The most trustworthy would be to start it with CreateObject. (or use
GetObject which would get an existing running instance if one was up).

--
Regards,
Tom Ogilvy


Jack <replyto@newsgroup wrote in message
...
I mean Excel installed, not running.








  #5   Report Post  
Posted to microsoft.public.vb.general.discussion,microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to check programmatically whether Excel is installed on computer?

Tom is exactly right, but since you seem to need more detailed help than Tom
provided....

If Excel is installed, you'll be able to create an instance of the
Excel.Application object. If Excel is not installed, you won't be able to
create an instance of the Excel.Application object. So....attempt to create
an instance of this object and trap for an error (warning: air code).

Dim oXLApp As Object

On Error Resume Next
Set oXLApp = CreateObject("Excel.Application")
If oXLApp Is Nothing Then
MsgBox "Excel is not installed or is not installed correctly"
Else
MsgBox "Excel version " & oXLApp.Version & " is installed in '" &
oXLApp.Path & "'"
End If

There are other ways too. For example, you could use the FindExecutable API
function to determine which program, if any, is associated with the .XLS
extension. This, however, is not foolproof for determining if Excel is
installed because other programs could be associated with the .XLS
extension. You could also check any of a number of different Registry keys.
This also is not reliable because Registry keys are frequently left behind
after a program is uninstalled. Both of these alternatives are also more
work (i.e. require more code) than just trying to instantiate the object.

I think Tom's suggestion of just trying to instantiate the Excel.Application
object is the easiest and most reliable means of determining if Excel (or
any application that is an Automation server) is installed and, moreover,
installed correctly.

Mike


"Jack" <replyto@newsgroup wrote in message
...
Tom, not running theExcel instance, but the existance of the installed
program I need to check.

"Tom Ogilvy" wrote in message
...
The most trustworthy would be to start it with CreateObject. (or use
GetObject which would get an existing running instance if one was up).

--
Regards,
Tom Ogilvy


Jack <replyto@newsgroup wrote in message
...
I mean Excel installed, not running.










  #6   Report Post  
Posted to microsoft.public.vb.general.discussion,microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to check programmatically whether Excel is installed on computer?

Hi Jack,

There are lots of ways, this one attempts to start Excel in the background
and checks for an error to be raised. The drawback is this method of
checking will take longer than other options, the benefit is that it is
simple and will work with any version of Excel.

Public Function IsExcelInstalled() As Boolean
Dim obj As Object

IsExcelInstalled = True

On Error GoTo ErrHandler

Set obj = CreateObject("Excel.Application")
Set obj = Nothing

Exit Function

ErrHandler:
IsExcelInstalled = False
End Function

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada


"Jack" <replyto@newsgroup wrote in message
...
I mean Excel installed, not running.




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default How to check programmatically whether Excel is installed on computer?

If you're not satisfied with the CreateObject solution (although I can't see
why... perhaps memory resources, perhaps you need to check remotely?) then
you could inspect the registry for the existence of the
HKEY_CLASSES_ROOT\Excel.Application key.


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Jack" <replyto@newsgroup wrote in message
...
I mean Excel installed, not running.




  #8   Report Post  
Posted to microsoft.public.vb.general.discussion,microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to check programmatically whether Excel is installed on computer?

"Jack" <replyto@newsgroup wrote:

I mean Excel installed, not running.


You didn't say what program you want to use to check it, so there's no
single answer.

In a batch file, you could use the ASSOC command to see if the .XLS file
type has a file association. If it doesn't, either Excel is not
installed or it was not installed correctly. If it does, either Excel
is installed or it has been installed and then uninstalled (I'm not sure
whether the uninstall program deletes the entry). Once you know the
file association, you can use the FTYPE command to get the path to the
executable.

C:\Documents and Settings\Administratorassoc .xls
.xls=Excel.Sheet.8

C:\Documents and Settings\Administratorftype excel.sheet.8
excel.sheet.8="C:\Program Files\Microsoft Office\Office\EXCEL.EXE" /e

This information is also available through the Windows API if you're
using VB (or other language that gives you access to the API).

As someone has already said, if you want to know whether Excel is
actually runnable, you'll have to try to run it.



==
Jack Hamilton


==
In the end, more than they wanted freedom, they wanted comfort and security.
And in the end, they lost it all - freedom, comfort and security.
Edward Gibbons
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
Formulaed cell response varies from computer to computer WKH Excel Discussion (Misc queries) 3 November 21st 07 06:37 PM
how do I only do payroll check stubs on the computer Nancy[_3_] Excel Discussion (Misc queries) 2 November 14th 07 08:48 PM
How do I copy all Excel files from old computer to new computer? Rfarsh Excel Discussion (Misc queries) 2 December 20th 05 03:23 AM
If I don't have MS equation installed in my MS excel how should I sharat Excel Worksheet Functions 1 October 25th 05 02:19 PM
Autocomplete works with my home computer but not the office computer Andy Excel Discussion (Misc queries) 4 December 11th 04 07:21 PM


All times are GMT +1. The time now is 03:21 AM.

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

About Us

"It's about Microsoft Excel"