Excel-DNA / Excel-DNA/ExcelDna

xlfEvaluate using local language (here: german)

Open
#408 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
292
Avg merge
20d 12h
Merged PRs (30d)
1

Description

Hi Govert!

I'm trying to replicate some XLM Macros and on this way I need to evaluate references to constructed formulae (like IF or parts of a sumproduct function) to achieve the results of XLM.
Now I found that calling
`Dim res As Object = Nothing`
`Dim test As Object = TryExcel(xlfEvaluate, res, "IF(A1=3,A2,A3)")`
doesn't work (it returns ok, but res is ExcelErrorValue 15) because Excel wants the local language here.
So
`Dim res As Object = Nothing`
`Dim test As Object = TryExcel(xlfEvaluate, res, "WENN(A1=3;A2;A3)")`
does work. Which is terrible, because I can't really construct the formulae in german and expect it to work all around the world. Is there a way to bring xlfEvaluate to accept english (= locale independent) language?

EDIT:
I found a hint on [docs.microsoft.com](https://docs.microsoft.com/sv-se/office/client-developer/excel/excel4-excel12) that says that if you set the xlIntl bit in iFunction, the function or command is carried out as if it were being called from an International Macro Sheet. This means that the command behaves as it would on the U.S. version of Excel, even if it is running on an international (localized) version.

So, following [docs.microsoft.com](https://docs.microsoft.com/en-us/office/client-developer/excel/calling-into-excel-from-the-dll-or-xll) this should be done by
` XLOPER12 xSum, xResult;`
` xSum.xltype = xltypeStr;`
` xSum.val.str = L"\015=SUM(X1:X100)";`
` Excel12(xlcFormula | xlIntl, &xResult, 2, &xSum, TempActiveRef(2,2,1,1));`

Maybe there is a way to bring that into ExcelDNA?

-regards,
Roland

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.