Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have an addin that references a third party dll but it is not always
installed on the target machine. I simply want to be able to disable any of my menu items and buttons that use the dll if it is not installed. In the workbook open event, how can I find out if the dll is installed. Thanks for any help Fred |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Fred,
This should give you an idea of how to test for an object. I've done it using word, but you should be able to tweak it for a generic dll (referencing the class in the dll). Do not set a reference to the dll in question in the project, or it will spit the dummy when the project loads if the dll is not there. Instead tweak this to try and create the object, and if you can't, disable the menus in question. Option Explicit Option Private Module Private Sub TestForObject() MsgBox ObjectExists("Word.Application") End Sub Private Function ObjectExists(strObject As String) As Boolean Dim objTest As Object On Error Resume Next Set objTest = GetObject(, strObject) If Not objTest Is Nothing Then ObjectExists = True Else Set objTest = CreateObject(strObject) If Not objTest Is Nothing Then ObjectExists = True objTest.Quit 'specific to word, may not be needed with a dll Set objTest = Nothing End If End If On Error GoTo 0 End Function Robin Hammond www.enhanceddatasystems.com "Fred" <leavemealone@home wrote in message ... I have an addin that references a third party dll but it is not always installed on the target machine. I simply want to be able to disable any of my menu items and buttons that use the dll if it is not installed. In the workbook open event, how can I find out if the dll is installed. Thanks for any help Fred |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Checking & installing references as part of on_open | Excel Programming | |||
Missing References | Excel Programming | |||
References.Remove References(1) DOES NOT WORK for "MISSING:" Refs | Excel Programming | |||
checking for missing values | Excel Programming | |||
Bad or Missing References | Excel Programming |