Functions from XLL Addd-In are not available

Add-in Express™ Support Service
That's what is more important than anything else

Functions from XLL Addd-In are not available
Excel show #NAME error instead of the UDF from the XLL Add-In 
Dirk




Posts: 73
Joined: 2017-10-05
Hello,

We regsiter a XLL and a COM Add-in in Excel using adxregistrator. If I start excel using a unit test, the XLL Function are not available and excel shows #NAME instead fo the function.
Excel is command line is"C:\Program Files (x86)\Microsoft Office\Root\Office16\EXCEL.EXE" /automation -Embedding.
Further the add in manager from excel, that the XLL add-in is active, but it shows the name 'adxloader.<our-add-in-name>.dll instead of the name "OurAddInName" that is given in the ADXModule.AddinName property.

What should we do that
a) The XLL function are available
b) The Add-In Name is correct.
best regards,
Dirk
Posted 26 Mar, 2019 05:44:20 Top
Dmitry Kostochko


Add-in Express team


Posts: 2865
Joined: 2004-04-05
Hi Dirk,

Thank you for the detailed description.

You have run into a well-known Excel issue, please have a look at the following thread for more details:
Excel UDF return #NAME? (AddIn does not load) when executed programmatically

I have just re-tested the workaround described in the thread above by using the following Word macro:

Public Sub startExcel()

Dim excel As Object

Set excel = CreateObject("Excel.Application")

excel.workbooks.Add
excel.Visible = True

excel.AddIns.Item("XLLAddinTest").Installed = False
excel.AddIns.Item("XLLAddinTest").Installed = True

' =AllSupportedExcelTypes(123)

Set excel = Nothing

End Sub


The issue is solved on my machine, hope you will be able to apply this workaround. Note, "XLLAddinTest" is the name of my XLL, please correct it on your side.
Posted 26 Mar, 2019 06:42:50 Top
Dirk




Posts: 73
Joined: 2017-10-05
This is not a solution we can accept, because this behavior happens also at our customer side. We cannot make them run a basic application. Our current workaround is, that the com add-in does exactly that. But this is related to my question XLL Modul vs. ExcelApplication.RegisterXll see: https://www.add-in-express.com/forum/read.php?&MID=79422

Wouldn't it be better to use ExcelApplication.RegisterXll if the adxregister approach does not give reliable results?
Posted 27 Mar, 2019 02:15:48 Top
Dmitry Kostochko


Add-in Express team


Posts: 2865
Joined: 2004-04-05
Hi Dirk,

Sure, you can OFF and ON your XLL by the code of your com add-in.

Wouldn't it be better to use ExcelApplication.RegisterXll if the adxregister approach does not give reliable results?


As you know, XLLs cannot be registered for all users of a machine. Our adxregistrator.exe registers XLL for the current user during installation and unregisters it on uninstallation. Of course, you can try to call the RegisterXll method in your com add-in, this should register your XLL for every user of the machine but what code will unregister it? Or is it not a problem?
Posted 27 Mar, 2019 04:18:25 Top
Dirk




Posts: 73
Joined: 2017-10-05
We will register the functions (UDF) for every single user on that machine if the COM add-in is loaded.
I thought it is only for the current user.
Second: I thought the RegisterXll registers the UDF only until excel is restarted. Am I wrong with this assumption?
So my scenario is:
The COM Add-In is loaded as registered per user or for every user. When the COM Add-In is loaded it registers the UDF with RegisterXll call. After Excel terminates the functions (UDF) are not available. If the COM Add-In is deinstalled the RegisterXll is not called and therefor no UDF is available.
Can you pls confirm that ExcelApp.RegisterXll is an allowed operation for the XLL module?
How can I prevent the registration of the XLL modul as Excel Add-in?

best regards
Dirk
Posted 01 Apr, 2019 05:59:05 Top
Andrei Smolin


Add-in Express team


Posts: 17375
Joined: 2006-05-11
Hello Dirk,

Dirk Reuß writes:
Second: I thought the RegisterXll registers the UDF only until excel is restarted. Am I wrong with this assumption?


You are right: calling RegisterXll registers the XLL add-in for the current session only: this doesn't create registry entries required for the XLL add-in to get loaded automatically when Excel is restarted. Still, calling RegisterXll from a COM add-in may be too late: I suppose that if Excel refreshes formulas when a workbook is opened at Excel startup, it does that before your COM add-in is loaded - you would need to verify this.

Dirk Reuß writes:
Can you pls confirm that ExcelApp.RegisterXll is an allowed operation for the XLL module?


Yes, it is. I've just used it to compose the previous paragraph. Earlier, I used this to load the XLL when Excel is started programmatically (in this case Excel, doesn't load Excel UDFs by design).

Dirk Reuß writes:
How can I prevent the registration of the XLL modul as Excel Add-in?


Add-in Express doesn't support this. You can create a custom action in your installer; the custom action should delete the registry value that adxregistrator creates.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 02 Apr, 2019 04:23:44 Top
Dirk




Posts: 73
Joined: 2017-10-05
Ok. Thanks for your detailed answer.
Posted 02 Apr, 2019 09:36:54 Top
Andrei Smolin


Add-in Express team


Posts: 17375
Joined: 2006-05-11
You are welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 02 Apr, 2019 09:45:09 Top
Dirk




Posts: 73
Joined: 2017-10-05
I' ve testet the following:
- In our XLLModule: ADXXLLModule we do nothing in the function
public static void RegisterXLL(Type t)
public static void UnregisterXLL(Type t)
- remove the ComVisible and ProgId and Guid Attribute from the class
=> after using adxregister /install the XLLModule was not registered as Excel Add-In any more.
=> after using ExcelApp.RegisterXll(<path>) from the COM Add-In the functions from the XLLModule are loaded correctly and are working.
Posted 04 Apr, 2019 03:39:26 Top
Andrei Smolin


Add-in Express team


Posts: 17375
Joined: 2006-05-11
Dirk,

The attributes are part of the Add-in Express infrastructure. They play their role in development, debugging, and deployment processes. We don't recommend that you modify or delete them as we don't provide support for solutions that modify or delete them.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 04 Apr, 2019 05:29:23 Top