Dynamically add a Reference to an Add-In in VBA (Excel 2000?)

R

Richard

Is it possible, in VBA, to ADD a reference to an Addin dynamically -
WITHOUT
using the Tools/Reference dialog box?

In other words:
I have an Addin (.xla) that contains functions/methods.
I wish to use these functions/methods in the VBA of a WorkBook.
I do not know where the .xla is located - except that it's in the same
folder as the Workbook itself.

And Finally, since many people will be using the Workbook, I do not
want to
ask them to 'manually' add a 'reference' to the XLA. This has to be
done automatically...

So, is it possible to Dynamically add a reference to my Add-In, using
VBA in Excel 2000 (without requiring any other add-ins if possible?)

THANKS !!
Richard
 
R

Rajan Lengde

Dim a As AddIn
Set a = Application.AddIns.Add("someaddin.xla", True)
a.Installed = True

Tools/references in VBA adds references to dll or other components not a
addin
Addin can be added from tools/addins from excel's main window itself.
 
K

keepITcool

try:

Sub AddMeAsReference()
If ActiveWorkbook Is ThisWorkbook Then
Beep
If ActiveWorkbook.VBProject.Name = ThisWorkbook.VBProject.Name Then
Beep
Else
ActiveWorkbook.VBProject.References.AddFromFile ThisWorkbook.FullName
End If

End Sub

BUT (and it's a BIG but)

the user's security settings can allow and prevent
"Access to Visual Basic Project"
if that access is OFF than any attempt to read or alter
vbproject properties will fail.


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Richard wrote :
 

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

Top