ExcelDna Functions Don't Load When Excel is Started Programmatically

38 views
Skip to first unread message

Brent Hungerford

unread,
Apr 21, 2022, 6:57:57 PM4/21/22
to Excel-DNA
We've confirmed functions work when manually opening a workbook.

We're launching Excel and opening a workbook using Interop in C#.  We then find our functions don't load in this process.

Full process:
1)  Excel workbook is open with UDFs loaded.
2)  We run a UDF in Excel that checks for installed UDFs version.
3)  If there's a newer version of UDFs available from a common directory, we launch an external exe.
4)  The external exe saves and closes the workbook and Excel, copies new UDF files into the AddIns folder, and reopens the previously open workbook.

When step 4 happens, UDFs are not loaded.

Any recommendations you could provide would be appreciated.  Thanks!

Govert van Drimmelen

unread,
Apr 22, 2022, 4:07:53 AM4/22/22
to exce...@googlegroups.com

Hi Brent,

 

When Excel is started via COM Interop, add-ins are not loaded automatically.

You can explicitly load an add-in in this situation by calling Application.RegisterXLL.

 

-Govert

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/edce1664-4790-40dc-9c91-d32959b745aen%40googlegroups.com.

Brent Hungerford

unread,
Apr 22, 2022, 12:16:50 PM4/22/22
to Excel-DNA
Thank you, Govert - this works.  For all follow-up readers, the full path of the xll was required, similar to that shown below:

oExcelApp.RegisterXLL(System.Environment.ExpandEnvironmentVariables(@"C:\Users\%USERNAME%\AppData\Roaming\Microsoft\AddIns\<myExcelAddInName.xll>"));

Reply all
Reply to author
Forward
0 new messages