[Feature Request] When using xlfCaller, add the worksheet reference of the caller to excelreference.

64 views
Skip to first unread message

Trevor Philips

unread,
May 14, 2024, 6:15:31 AMMay 14
to Excel-DNA
When using the CApi function xlfCaller, it returns an ExcelReference object containing the row and column of the calling cell, as well as a sheetid. We can concatenate the row and column to form an R1C1 address and then use ConvertFormula to convert it to an xlA1 address. However, to obtain the absolute calling cell, we need to iterate through all worksheets, compare the sheetid, and sometimes encounter situations where the worksheet names are the same but the sheetIds obtained are different, especially if the workbook has not been modified. It would be helpful if the ExcelReference directly included the worksheet to which the calling cell belongs, or if we could extract the absolute address of the calling cell (e.g., [book1]Sheet1!$A$1) from it.

Govert van Drimmelen

unread,
May 14, 2024, 8:36:07 AMMay 14
to exce...@googlegroups.com

Hi Trevor,

 

You can the calling sheet info like this:

  var sheetName = XlCall.Excel(XlCall.xlSheetNm, caller); 

 

But it is a good suggestion to add some easier way to get e.g. the matching Range COM object.

 

-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/b5106492-3d3d-4ee7-9ac7-43e693067083n%40googlegroups.com.

Message has been deleted

Trevor Philips

unread,
May 18, 2024, 1:21:28 AMMay 18
to Excel-DNA

Thank you, Govert! Looking forward to seeing this feature in future versions.

By the way, the latest ExcelDNA that supports .NET 8 seems to allow configuring ExternalLibrary in the csproj file. However, in my practice project, when I configured multiple ExternalLibrary entries, it seemed that only one of them was packaged into the .dna file? (I can't recall where I checked the packaged .dna file, as it's been a while since I  practiced  on that project, and, unfortunately, I've already deleted it.)

Govert van Drimmelen

unread,
May 18, 2024, 5:49:06 AMMay 18
to exce...@googlegroups.com

Hi Trevor,

 

Adding the extra add-in libraries seems to work fine for me.

I’ve made a small test project here: govert/TestMultiProj (github.com)

 

Here we have the ‘main’ add-in project (TestMultiProj) and then an addition add-in project (MoreFunctions) that should be a packed ExternalLibrary.

The key is to have the ProjectReference, and then also add an entry to the TestMultiProj.csproj file like this:

 

  <PropertyGroup>

    <!-- Comma-separated list of additional add-in libraries to add as 'ExternalLibrary' entries in the generated .dna file -->

    <ExcelAddInExports>MoreFunctions.dll</ExcelAddInExports>

  </PropertyGroup>

 

Let me know if this still does not work for you.

Message has been deleted

Trevor Philips

unread,
May 23, 2024, 9:16:30 AMMay 23
to Excel-DNA

Hello, Govert! I'm sorry for the delay in replying. I've been on vacation these past few days. Thank you for the little test project. After modifying it according to the little test project, I've achieved the desired effect:

```xml
<PropertyGroup>
<ExcelAddInExports>ExcelDNATest.AdditionalFunctions.dll;ExcelDNATest.MoreFunctions.dll</ExcelAddInExports>
</PropertyGroup>
```
Reply all
Reply to author
Forward
0 new messages