Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Compile Error: Can't find project or library (missing Add-in)

I have built a workbook that call subroutines in an add-in (.xla). If the
workbook is run on another PC for the first time I get the above compile
error, because the add-in is missing and my workbook code crashes. Is it
possible to check in a macro that the add-in is present and exit gracefully
(perhaps displaying a message saying the Add-in is missing)?

--
Trefor
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Compile Error: Can't find project or library (missing Add-in)

If you've set a reference in your workbook to the add-in there is no way to
trap an error if it is not present, as far as I know. But if you're running
add-in code in some other way (like using RUN) you could check whether the
add-in is open like this first:

Function AddinPresent() As Boolean
Dim WBName As String
On Error GoTo NotPresent
WBName = Workbooks("YourAddin.xla").Name
AddinPresent = True
NotPresent:
End Function

--
Jim
"Trefor" wrote in message
...
|I have built a workbook that call subroutines in an add-in (.xla). If the
| workbook is run on another PC for the first time I get the above compile
| error, because the add-in is missing and my workbook code crashes. Is it
| possible to check in a macro that the add-in is present and exit
gracefully
| (perhaps displaying a message saying the Add-in is missing)?
|
| --
| Trefor


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Compile Error: Can't find project or library (missing Add-in)

Jim,

Thankyou for the reply. I have set a reference to a .xla, I have not used
the RUN method before, if I did what are the disadvantages if I changed
everytrhing to use RUN? (I presume you are talking about a .xlm?) I have no
idea how to even create one of these.

Life wasn't meant to be easy was it?

Trefor
--
Trefor


"Jim Rech" wrote:

If you've set a reference in your workbook to the add-in there is no way to
trap an error if it is not present, as far as I know. But if you're running
add-in code in some other way (like using RUN) you could check whether the
add-in is open like this first:

Function AddinPresent() As Boolean
Dim WBName As String
On Error GoTo NotPresent
WBName = Workbooks("YourAddin.xla").Name
AddinPresent = True
NotPresent:
End Function

--
Jim
"Trefor" wrote in message
...
|I have built a workbook that call subroutines in an add-in (.xla). If the
| workbook is run on another PC for the first time I get the above compile
| error, because the add-in is missing and my workbook code crashes. Is it
| possible to check in a macro that the add-in is present and exit
gracefully
| (perhaps displaying a message saying the Add-in is missing)?
|
| --
| Trefor



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Compile Error: Can't find project or library (missing Add-in)

I don't know of any disadvantage except that it's a little more cumbersome
to call a sub via Run than directly. In theory Run is a little slower but I
don't see a difference as a practical matter.

I don't know what you mean by "xlm". All I'm saying is replace a direct
call to the add-in's sub:

SubInXLA

with

Run "MyAddin.xla!SubInXLA"

Of course this requires that the add-in is open in Excel.

It will take you only a few seconds to switch one or two call and test how
it works for you. check out the Run method for moe on it.

--
Jim
"Trefor" wrote in message
...
| Jim,
|
| Thankyou for the reply. I have set a reference to a .xla, I have not used
| the RUN method before, if I did what are the disadvantages if I changed
| everytrhing to use RUN? (I presume you are talking about a .xlm?) I have
no
| idea how to even create one of these.
|
| Life wasn't meant to be easy was it?
|
| Trefor
| --
| Trefor
|
|
| "Jim Rech" wrote:
|
| If you've set a reference in your workbook to the add-in there is no way
to
| trap an error if it is not present, as far as I know. But if you're
running
| add-in code in some other way (like using RUN) you could check whether
the
| add-in is open like this first:
|
| Function AddinPresent() As Boolean
| Dim WBName As String
| On Error GoTo NotPresent
| WBName = Workbooks("YourAddin.xla").Name
| AddinPresent = True
| NotPresent:
| End Function
|
| --
| Jim
| "Trefor" wrote in message
| ...
| |I have built a workbook that call subroutines in an add-in (.xla). If
the
| | workbook is run on another PC for the first time I get the above
compile
| | error, because the add-in is missing and my workbook code crashes. Is
it
| | possible to check in a macro that the add-in is present and exit
| gracefully
| | (perhaps displaying a message saying the Add-in is missing)?
| |
| | --
| | Trefor
|
|
|


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Compile Error: Can't find project or library (missing Add-in)

Jim,

Thank you again for your reply. But I am still having problems:

This is the main workbook:

Option Explicit
Option Private Module
Public Const DCMaster = "Customer Data Collect Master v6.37.xla"

Sub Auto_Open()
If AddinPresent Then
Application.Run DCMaster & "!test" <----- This says it can't find
the macro
Else
MsgBox "Addin Not Present"
End If
End Sub

Function AddinPresent() As Boolean <----- This works great thankyou
Dim WBName As String
On Error GoTo NotPresent
WBName = Workbooks(DCMaster).Name
AddinPresent = True
NotPresent:
End Function

This is the macro in the .xla:

Public Sub test()
MsgBox "test"
End Sub

Trefor
--
Trefor


"Jim Rech" wrote:

I don't know of any disadvantage except that it's a little more cumbersome
to call a sub via Run than directly. In theory Run is a little slower but I
don't see a difference as a practical matter.

I don't know what you mean by "xlm". All I'm saying is replace a direct
call to the add-in's sub:

SubInXLA

with

Run "MyAddin.xla!SubInXLA"

Of course this requires that the add-in is open in Excel.

It will take you only a few seconds to switch one or two call and test how
it works for you. check out the Run method for moe on it.

--
Jim
"Trefor" wrote in message
...
| Jim,
|
| Thankyou for the reply. I have set a reference to a .xla, I have not used
| the RUN method before, if I did what are the disadvantages if I changed
| everytrhing to use RUN? (I presume you are talking about a .xlm?) I have
no
| idea how to even create one of these.
|
| Life wasn't meant to be easy was it?
|
| Trefor
| --
| Trefor
|
|
| "Jim Rech" wrote:
|
| If you've set a reference in your workbook to the add-in there is no way
to
| trap an error if it is not present, as far as I know. But if you're
running
| add-in code in some other way (like using RUN) you could check whether
the
| add-in is open like this first:
|
| Function AddinPresent() As Boolean
| Dim WBName As String
| On Error GoTo NotPresent
| WBName = Workbooks("YourAddin.xla").Name
| AddinPresent = True
| NotPresent:
| End Function
|
| --
| Jim
| "Trefor" wrote in message
| ...
| |I have built a workbook that call subroutines in an add-in (.xla). If
the
| | workbook is run on another PC for the first time I get the above
compile
| | error, because the add-in is missing and my workbook code crashes. Is
it
| | possible to check in a macro that the add-in is present and exit
| gracefully
| | (perhaps displaying a message saying the Add-in is missing)?
| |
| | --
| | Trefor
|
|
|





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Compile Error: Can't find project or library (missing Add-in)

Hi Tefor,

Application.Run DCMaster & "!test" <----- This says it can't find


Look at the syntax suggested by Jim and look at the Run method in VBA help.

Try:

Application.Run "DCMaster.xla!test"

---
Regards,
Norman



"Trefor" wrote in message
...
Jim,

Thank you again for your reply. But I am still having problems:

This is the main workbook:

Option Explicit
Option Private Module
Public Const DCMaster = "Customer Data Collect Master v6.37.xla"

Sub Auto_Open()
If AddinPresent Then
Application.Run DCMaster & "!test" <----- This says it can't find
the macro
Else
MsgBox "Addin Not Present"
End If
End Sub

Function AddinPresent() As Boolean <----- This works great thankyou
Dim WBName As String
On Error GoTo NotPresent
WBName = Workbooks(DCMaster).Name
AddinPresent = True
NotPresent:
End Function

This is the macro in the .xla:

Public Sub test()
MsgBox "test"
End Sub

Trefor
--
Trefor


"Jim Rech" wrote:

I don't know of any disadvantage except that it's a little more
cumbersome
to call a sub via Run than directly. In theory Run is a little slower
but I
don't see a difference as a practical matter.

I don't know what you mean by "xlm". All I'm saying is replace a direct
call to the add-in's sub:

SubInXLA

with

Run "MyAddin.xla!SubInXLA"

Of course this requires that the add-in is open in Excel.

It will take you only a few seconds to switch one or two call and test
how
it works for you. check out the Run method for moe on it.

--
Jim



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
Compile error: Can't find project or library Melanie New Users to Excel 14 August 21st 09 02:54 AM
Compile error: Can't find project or library Vince Excel Programming 2 October 13th 05 04:50 PM
Compile error: Can't find project or library Daniel[_17_] Excel Programming 3 December 8th 04 01:05 PM
Compile Error, Can'f Find Project or Library therrm Excel Programming 1 November 25th 03 04:53 AM
Compile Error! Can't find project or Library --- Help! Suh Suk Ho Excel Programming 2 July 21st 03 08:26 PM


All times are GMT +1. The time now is 12:39 PM.

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"