Can an AddIn Know Its Location?

21 views
Skip to first unread message

Tom Baxter

unread,
Sep 23, 2021, 9:56:45 AMSep 23
to Excel-DNA
Is it possible for a UDF to determine what folder it resides in (I am referring to the XLL file here)? More generally, is it possible for a UDF to enumerate all installed add-ins and know where they reside?

Govert van Drimmelen

unread,
Sep 23, 2021, 12:41:30 PMSep 23
to Excel-DNA
--------------------------------------------------
Excel-DNA is now registered on GitHub Sponsors.
You can add Excel-DNA support with easy billing through a corporate GitHub account.
--------------------------------------------------

Hi Tom,

You can call ExcelDnaUtil.XllPath to get the path of the .xll file.

To enumerate all the loaded add-ins, you'd use the Excel COM object model.
You get the root Application object by calling ExcelDnaUtil.Application (this will be an object of type Microsoft.Office.Interop.Excel.Application).
From there, you can look at the Application.AddIns and Application.AddIns2 collections.

-Govert
Reply all
Reply to author
Forward
0 new messages