View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John.Greenan John.Greenan is offline
external usenet poster
 
Posts: 175
Default Importing libraries explicitly in macro code

if you set a workbook reference then this should remain in you addin after
you distribute it. What is the problem you are encountering - that the user
does not have the dlls on his/her PC? There's no way to statically link in
excel vba.

You can try and use Microsoft Visual Basic for Applications Extensibility
5.3 - typically installed in "C:\Program Files\Common Files\Microsoft
Shared\VBA\VBA6\VBE6EXT.OLB" and then use

Dim oReference As VBIDE.Reference
and

ThisWorkbook.VBProject.References.AddFromFile
or
ThisWorkbook.VBProject.References.AddFromGuid

to add the references at run time. It's quite tricky, as you will have to
identify the GUID or file names and then work out how to handle the missing
reference.



--
www.alignment-systems.com


"shivboy" wrote:


I am working on a project which uses the following object libraries:

Microsoft DAO 3.6 Object Library
Microsoft ADO Ext. 2.8 for DDL and Security
Microsoft Access 10.0 Object Library
Microsoft ActiveX Data Objects 2.0 Library

How can I explicitly inherit these libraries in my macro code so that
no error is thrown due to non-inheritance of the libraries in user's
machine.

Furthermore, is there a location where I can find the complete
reference list of these libraries?

Please help.

Peace,

Shivboy


--
shivboy
------------------------------------------------------------------------
shivboy's Profile: http://www.excelforum.com/member.php...o&userid=35137
View this thread: http://www.excelforum.com/showthread...hreadid=551762