ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trapping the "Can't find project or library error" (https://www.excelbanter.com/excel-programming/321406-trapping-cant-find-project-library-error.html)

Ajtb

Trapping the "Can't find project or library error"
 
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

Bob Phillips[_6_]

Trapping the "Can't find project or library error"
 
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)


"Ajtb" wrote in message
...
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





All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com