I have some xla and xll files in the XLStart
folder. In C# I would like to find out the addins that are currently loaded.
These addins are not accessible using Globals.ThisAddIn.Application.AddIns
but I found this Globals.ThisAddIn.Application.VBE.VBProjects
from here. The problem with using Globals.ThisAddIn.Application.VBE.VBProjects
is that it doesn't list all my xla and xll files.
Any ideas to list all the addins loaded from XLStart
folder?
Any Excel file, including add-ins, that are loaded from the XLSTART directory will, by default, NOT be part of the
Addins
collection.An add-in file loaded from XLSTART will be visible in the VBE, but because it is an add-in, the file is not visible in Excel, and it is not enumerable in the
Workbooks
collection.Enumerating the VBE projects is one approach, but it requires the VBE to be accessible under the user's Excel security settings, and when inspecting a project, you need to be aware projects that are saved/unsaved, protected/unprotected, and those that are projects referenced by other projects.
However, just because the Workbooks collection won't enumerate the non-visible add-ins doesn't mean that they aren't in the
Workbooks
collection.If you know the name of the add-in that you're looking for, you can use:
So, if you enumerate the file names in the XLSTART directory, and then check that:
For each file, then you'll know which XLSTART files are loaded.