ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to parse UDF arguments? (separators are localized) (https://www.excelbanter.com/excel-programming/402166-how-parse-udf-arguments-separators-localized.html)

Joannes Vermorel

How to parse UDF arguments? (separators are localized)
 
We have designed an add-in for Excel 2003 in C# that need to parse the
arguments of an Excel UDF function (the content of the cell being
retrieved as text).

So far, we were just using an ad-hoc parser, but it fails within
localized version of Excel that do not use the comma as argument
separator.

What it the "safe" way to parse Excel function arguments? Is there any
way to know what is the separator character that should be used?

Thanks in advance,
Joannès

Bob Phillips

How to parse UDF arguments? (separators are localized)
 
You could check the Application.ThousandsSeparator property, if it is "."
then the UDF separator ill be ;.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Joannes Vermorel" wrote in message
...
We have designed an add-in for Excel 2003 in C# that need to parse the
arguments of an Excel UDF function (the content of the cell being
retrieved as text).

So far, we were just using an ad-hoc parser, but it fails within
localized version of Excel that do not use the comma as argument
separator.

What it the "safe" way to parse Excel function arguments? Is there any
way to know what is the separator character that should be used?

Thanks in advance,
Joannès



Charles Williams

How to parse UDF arguments? (separators are localized)
 
Not sure why you would want to go to the trouble of parsing out and then
evaluating UDF arguments from a text string.
(I can foresee a lot of difficulties to overcome if you want to handle the
general case for anything that could be an argument).

But you can get the separator character from
Application.International(xlListSeparator)

(although I have met one case where this gave ; but Excel was actually using
, never did really get to the bottom of that we just bypassed the problem)

regards
Charles
_________________________________________
FastExcel 2.3
Name Manager 4.0
http://www.DecisionModels.com

"Joannes Vermorel" wrote in message
...
We have designed an add-in for Excel 2003 in C# that need to parse the
arguments of an Excel UDF function (the content of the cell being
retrieved as text).

So far, we were just using an ad-hoc parser, but it fails within
localized version of Excel that do not use the comma as argument
separator.

What it the "safe" way to parse Excel function arguments? Is there any
way to know what is the separator character that should be used?

Thanks in advance,
Joannès



Joannes Vermorel

How to parse UDF arguments? (separators are localized)
 
But you can get the separator character from
Application.International(xlListSeparator)


Thanks Charles, this looks exactly to what I was looking for.

Best regards,
Joannès
http://www.lokad.com sales forecasting


All times are GMT +1. The time now is 09:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com