UDF runtime metadata

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

UDF runtime metadata
Is there a way to obtain it when the function is called? 
bobcalco




Posts: 66
Joined: 2019-03-20
In my ongoing saga to port functionality that I was able to implement in an application using a custom spreadsheet control from a well-known .NET component vendor to Excel, I am missing one more ingredient that even ExcelDNA doesn't seem to support, namely, knowing the context in which a UDF executes at runtime. Custom function interfaces in these spreadsheet components often offer a "context" parameter from which my custom function implementation can glean certain basic information about the execution environment - for example, I need to know: what cell is it running in, and on which worksheet? I use this information behind the scenes in a very important way.

If AddIn express supports this, it's so important that I'll go back to using AddIn Express to implement my UDFs, as I can accept a workaround for my other requirement (optional param array support). If not, I may not be able to do what I need to do at all.
Posted 27 Nov, 2021 08:59:16 Top
bobcalco




Posts: 66
Joined: 2019-03-20
OK, just a quick update: I was able to do this in ExcelDNA using its integration with the Excel C API, and it appears possible also using the COM object model, though the C API is faster and more direct. Does AddIn express also expose the Excel C API? For example, in ExcelDNA I was able to get the reference to the cell from which my UDF is being called as follows:

let cellRef = XlCall.Excel (XlCall.xlfCaller) :?> ExcelReference 


It looks like the COM API is also amenable to solving the problem, but somehow to get the address of the calling function, ROW() and COLUMN() build in functions/macros need to be called in the UDF. I will need the ability to compute these coordinates from AddIn Express side, which I'm using for the UX part of my solution.
Posted 28 Nov, 2021 10:47:41 Top
bobcalco




Posts: 66
Joined: 2019-03-20
I note the topic is discussed in the AddIn Express Getting Started PDF (http://cdn.add-in-express.com/docs/adxnet100.pdf), at around page 350. It had initially evaded my scan of the document, but it's clearly a doable thing.
Posted 28 Nov, 2021 14:45:07 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Bob,

It is doable. I have no doubt this is also doable with ExcelDNA. For ExcelDNA-related things, your search string should be

"Govert" {query}

e.g.

"Govert" caller cell

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Nov, 2021 05:57:37 Top
bobcalco




Posts: 66
Joined: 2019-03-20
Both you and Govert are very responsive to my inquiries, and I deeply appreciate it. :-)

I only use ExcelDNA because I need the ParamArray feature for UDFs in Excel, and (bonus!) it even lets me code in F#, which I highly prefer over VB and C#.

However, now I understand a bit better the apparent magic behind it and I could probably emulate it using AddIn Express if I had to.

My main issues with AddIn Express is having to run VS in administrator mode, and not being able to write AddIns in F#. But ExcelDNA's UX support is... lacking big-time compared to AddIn Express. So... life is trade off... and collaboration. :)
Posted 01 Dec, 2021 19:04:12 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Bob,

... and has always been. )))

Below is a citation from section Developer permissions; see the PDF file in the folder {Add-in Express}\Docs on your development PC.

===
For a non-admin user, it is possible to create a per-user Office extension, install or register it using e. g. "COM Add-ins" dialog box and then debug the add-in using menu Debug | Attach to Process in Visual Studio. Debugging a per-machine Office extension without administrative permissions is impossible.
===

To register your add-in in that dialog, click the Browse button, locate adxloader.dll or, if your Office is 64-bit, adxloader64.dll and click OK.

A more systematic way to register the add-in would be to run adxregistrator.exe as we describe in section Deploying a per-user Office extension via an MSI installer.

Both ways require that the complete set of add-in files is located in a folder imitating the installation folder of your add-in: all required files and assemblies must be in in that folder.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 02 Dec, 2021 04:22:40 Top