Re: Importing libraries explicitly in macro code

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Hi John,

The reason I raised this question was because I am making a macro in
Excel VBA which creates tables in Access, then provides user form to
enter data into the tables and finally retrieve data from the tables to
generate reports. Now, to do all this, I have had to use various library
references while making the code work. Since I had to manually go to
Tools > References to import the libraries, I am sure that the same
issue would lie with every user who would run the macro on his/her PC.
In that case, I cannot expect the user to first import all the files
manually and then start using the macro. It is for that purpose that I
wanted to inherit / import the required libraries into the code so that
wherever the code is run it works fine.

I am sure there must be a way to import these libraries so as to ensure
that the macro works fine everytime it is run.

Peace,

Shivboy

John.Greenan Wrote:
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?action=getinfo&userid=35137
View this thread:
http://www.excelforum.com/showthread.php?threadid=551762




--
shivboy
------------------------------------------------------------------------
shivboy's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=35137
View this thread: http://www.excelforum.com/showthread.php?threadid=551762

.



Relevant Pages

  • Working form has stopped working: Repost and Update
    ... Microsoft updates may have created the problem. ... I have inventoried the References listed in the Visual Basic window. ... There are four libraries mentioned. ... Microsoft Access 11.0 Object Library ...
    (comp.databases.ms-access)
  • Re: VBA errors in 2007 (works fine in 2003)
    ... It appears to be getting through the UnHideSheets macro, ... Pak allowing you to call functions in the ATP from within VBA. ... menu in VBA, choose References, and select "atpvbaen.xls". ... If there is the possibility of a name collision (two or more libraries ...
    (microsoft.public.excel.misc)
  • Re: cycle through a table
    ... Doug Steele, Microsoft Access MVP ... "Phil" wrote in message ... >> program and object libraries that provide functionality that may be ... References to the specific library files, ...
    (microsoft.public.access.modulesdaovba)
  • Working form has stopped working
    ... Microsoft updates may have created the problem. ... I have inventoried the References listed in the Visual Basic window. ... There are four libraries mentioned. ... Microsoft Access 11.0 Object Library ...
    (comp.databases.ms-access)
  • Re: Recommended order of VBA References in Access
    ... If precedence or speed are required, then the order of these references is ... An easy way to tell if the necessary libraries are ... > My applications do not use any Active X components. ... See http://www.Access.QBuilt.com for Microsoft Access tips. ...
    (microsoft.public.access.modulesdaovba)