Addin / Library Reference question

  • Thread starter Thread starter Stuart
  • Start date Start date
S

Stuart

Say an addin requires one or more References to be set.
When distributing the addin to a new user, can those
References be set programmatically within the addin's
code, please?

Regards
 
Stuart,

You would have to know the exact file name or the GUID of library
you wish to reference. If you do, then you can use code like

ThisWorkbook.VBProject.References.AddFromFile "full file name"
' or
ThisWorkbook.VBProject.References.AddFromGuid "guid", Major,
Minor


This should be in the Auto_Open procedure of the add-in, in a
module that does not use any objects defined in the library to
which you are adding the reference.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Many thanks.
Can you explain further for me please?

Say addin is developed under Excel2000 and being geared
for an Excel2000 or 2003 user.

Say the addin has code requiring a Reference to be set to
Microsoft Visual Basic for Applications Extensibility 5.3
(as in Excel2000).

Can you show me how to obtain the information I need
for the code (assuming I can access an Excel2003 machine)
please?

Regards and thanks.
 
Stuart,

The following will add a reference to the Extensibility 5.3
library.


ThisWorkbook.VBProject.References.AddFromGuid _
GUID:="{0002E157-0000-0000-C000-000000000046}", _
Major:=5, Minor:=3



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Many Thanks,

Regards.

Chip Pearson said:
Stuart,

The following will add a reference to the Extensibility 5.3
library.


ThisWorkbook.VBProject.References.AddFromGuid _
GUID:="{0002E157-0000-0000-C000-000000000046}", _
Major:=5, Minor:=3



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top