You can check ExcelDnaUtil.ExcelVersion.
-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 post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.
It works! Thank you !
Hi Alberto,
As far as I know, the dynamic arrays feature was turned gradually across a range of versions.
So even if you know the exact version details of Excel, you would not know whether dynamic arrays are enabled.
The right way to detect dynamic arrays is probably to check for one of the built-in functions that accompany the feature, like SORT or FILTER.
I think the C API code for the FILTER function is 614.
Maybe you can help to test something like this:
static bool? _supportsDynamicArrays;
[ExcelFunction(IsHidden=true)]
public static bool SupportsDynamicArrays()
{
if (!_supportsDynamicArrays.HasValue)
{
try
{
var result = XlCall.Excel(614, new object[] { 1 }, new object[] { true });
_supportsDynamicArrays = true;
}
catch
{
_supportsDynamicArrays = false;
}
}
return _supportsDynamicArrays.Value;
}
I have not tried in a version that does not support dynamic arrays, but AFAIK it should throw an exception (as opposed to return #VALUE from the XlCall.Excel).
Please let me know if you have a chance to try it.
-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/f9f88b72-450b-4e5d-a1d8-581958ad1503%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to exce...@googlegroups.com.
OK great!
Yes that’s a good idea – I’ll add it there for the next version.
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/448fc50b-f5ef-46ce-9725-1d60bf153155%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/448fc50b-f5ef-46ce-9725-1d60bf153155%40googlegroups.com.
Hi Alberto,
You can avoid the exception with something like this:
var returnValue = XlCall.TryExcel(614, out object result, new object[] { 1 }, new object[] { true });
// Now examine returnValue, which should be of type XlReturn – it will presumably be XlReturn.XlReturnSuccess for Dynamic Array Excel, otherwise XlReturn.XlReturnFailed or similar for non-DA Excel.
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/9e98c97c-c54d-4a5b-acef-45e31da1e8df%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/9e98c97c-c54d-4a5b-acef-45e31da1e8df%40googlegroups.com.