> I'm using MSOffice 95 (Windows 95) and VBA.
> from the menu Tools | References lists (among others) my own XLA (MY.XLA)
> How can I find out from code if MY.XLA has been referenced and installed.
>
> I tried
> For Each addinfile In Application.AddIns
> MsgBox addinfile.Name
> Next addinfile
>
> But this only displays the names of Excels own XLAs
>
Referencing and AddIn installation are two different issues. Referencing
allows one workbook to directly access the methods and properties of another
workbook.
The AddIns collection is a set of AddIn workbooks which have been recorded
in the Windows Registry. Members of the AddIns collection can be Installed
or Uninstalled (corresponding to whether they are checked in the Tools,
AddIns dialog). Installed AddIns are automatically loaded when you start
Excel, or when you install them.
To add an addin workbook to the AddIns collection using VBA, you use the Add
method of the AddIns collection:
AddIns.Add Filename:="A:\MYADDIN.XLA"
or you can do this manually in the addins dialog via the Browse button.
Once it has been added, you can install the addin with the Installed
property:
AddIns("myAddin").Installed = True
Set this property to False to uninstall it. You can also interrogate the
value of this property to see if the addin is installed.
If you are trying to determine whether an addin file has been added to the
AddIns collection, you can use something like this:
On Error Resume Next
y = "Autosave"
x = AddIns(y).Installed
If Err <> 0 Then
MsgBox y & " not added to addins"
Else
MsgBox y & " is added to addins"
End If
HTH,
John Green - Excel MVP
Sydney
Australia