Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Checking for missing references

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Checking for missing references

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
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
Checking & installing references as part of on_open KR Excel Programming 6 December 3rd 04 05:35 PM
Missing References Felix[_3_] Excel Programming 1 June 7th 04 03:19 PM
References.Remove References(1) DOES NOT WORK for "MISSING:" Refs Jamie Carper[_2_] Excel Programming 0 May 27th 04 04:22 PM
checking for missing values Jerry[_17_] Excel Programming 4 February 16th 04 09:34 PM
Bad or Missing References Bill B[_3_] Excel Programming 0 January 8th 04 01:29 PM


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