View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default Late binding to .XLA library??

How about:

ThisWorkbook.VBProject.References.AddFromFile "c:\book1.xla"

--
Jim Rech
Excel MVP
"Lee S" wrote in message
...
| In my spreadsheet I have code that references functions and classes in an
| .XLA file. When a user who does not have the .XLA file available opens
the
| spreadsheet they see a compile error when the Workbook Open event fires
| (even though the Open event itself does not call or even directly
reference
| any XLA resources).
|
| This actually makes perfect sense to me ... but that does not mean I
have
| to like it.
|
| Anyone know of a reliable way to prevent the compile error in this
| situation?
|
| Something comparable to late binding for functions in an XLA library would
| be nice. Then I could check if the library exists before I decide whether
| to make the function calls.
|
| I have discovered that if arrange my code /just right/, I can avoid the
| error by convincing VBA not to compile the modules that reference the
| non-existent library -- however that is not reliable enough to release to
| the users.
|
| I am tempted to port my .XLA into a Visual Basic and compile it into an
| ActiveX DLL, but I figured I would check with the group to see if anyone
had
| a good idea on this.
|
| Thanks!
| Lee
|
|