Trapping the "Can't find project or library error"

A

Ajtb

Hi
I have many workbooks on a school system that make reference to a common
Addin for the macros required. Sometimes when a workbook is loaded for
the first time, it does not know where the reference Addin workbook is
located. This generates the following error:
Compile error:
Can't find project or library

- and also places the unsuspecting user in the VBE mode.

How can I trap this event ?

Thanks in advance

Andrew Bourke
 
B

Bob Phillips

Hi Andrew,

A simple way would be to have a dummy function in the add-in, and make a
call to it early in your code. You can determine there whether the add-in is
loaded or not

Dim myVal
On Error GoTo no_addin
myVal = Application.Run("myAddin.xla!myFunc")
Exit Sub

no_addin:
MsgBox "Add-in not installed"


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top