Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default loading another application from excel vba

I want to be able to launch another vba-enabled application from an Excel
command button. I have the code and references to do this already. However,
I need to figure out how I can programmatically check to see if the computer
has the application installed before I try to dim an object for the
application. I need to do this because the Excel file would be used by
people that don't have the application as well as those that do. I want to
give the users that don't a meaningful error if they don't have it. How
would I go about doing that?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default loading another application from excel vba

If you cannot be sure that a machine has that program and typelib installed,
you cannot (or at least should not) declare any variables of types that are
defined in the program. For example,

' Instead of
Dim V As YourProg.SomeType
' Use
Dim V As Object

If you use the first line of code and the machine doesn't have the program
installed, the compiler will complain that SomeType is an unknown type,
probably before any of your code in the workbook executes.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"badazizi" wrote in message
...
I want to be able to launch another vba-enabled application from an Excel
command button. I have the code and references to do this already.
However,
I need to figure out how I can programmatically check to see if the
computer
has the application installed before I try to dim an object for the
application. I need to do this because the Excel file would be used by
people that don't have the application as well as those that do. I want
to
give the users that don't a meaningful error if they don't have it. How
would I go about doing that?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default loading another application from excel vba

Have you tried capturing an error when setting the object?

Dim oApp As Object
On Error GoTo NotAvailable
Set oApp = CreateObject("NameOfApp.application") 'As appropriate
GoTo Available
NotAvailable:
MsgBox "Application was NOT available on this machine"
Exit Sub
Available:
MsgBox "Application IS available on this machine"
'Othe code here


It would be done like this for Word:

Dim oWord As Object
On Error GoTo NotAvailable
Set oWord = CreateObject("word.application")
GoTo Available
NotAvailable:
MsgBox "Word was NOT available on this machine"
Exit Sub
Available:
MsgBox "Word IS available on this machine"

HTH,
Bernie
MS Excel MVP


"badazizi" wrote in message
...
I want to be able to launch another vba-enabled application from an Excel
command button. I have the code and references to do this already. However,
I need to figure out how I can programmatically check to see if the computer
has the application installed before I try to dim an object for the
application. I need to do this because the Excel file would be used by
people that don't have the application as well as those that do. I want to
give the users that don't a meaningful error if they don't have it. How
would I go about doing that?



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
excel loading add-in.. [email protected] Excel Programming 1 April 9th 07 07:47 PM
Failed userform loading and cause application crash noiseash Excel Programming 1 August 25th 05 03:35 PM
Loading excel Mike R Excel Discussion (Misc queries) 13 March 1st 05 07:04 PM
Excel Add-In loading xlpuzzled Excel Discussion (Misc queries) 6 February 4th 05 01:00 AM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM


All times are GMT +1. The time now is 06:58 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"