How to parse UDF arguments? (separators are localized)

  • Thread starter Joannes Vermorel
  • Start date
J

Joannes Vermorel

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
 
B

Bob Phillips

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)



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
 
C

Charles Williams

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top