Locale issue with union operator string (,)

F

Fabz

The Excel union operator string is different for different locales (e.g. the
semicolon ";" in France and the comma "," in the US). I want to read out
Excel Ranges using A1-style notation using the union operator, e.g.

Excel.Range myRange = get_Range("A1,A2,A3", missing);

Thus I have to consider locales when assembling my cell references string.
Although when using VSTO 2008 the locale issue should be hidden behind
wrapper objects when accessing the COM interface, this doesn't seem to be
true when using the union operator inside String cell references. My
operating system being Swiss German for instance does not accept "A1,A2,A3"
as an input but only accepts "A1;A2;A3".

Is it safe to read out
System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator to
find the union operator? Or is this unsafe since another Excel Add-In might
actually temporarily change the current locale? Or is there any better way
to find out how to assemble my cell references String? I prefer not using
the Application.Union method, because in my case this would probably result
in accessing the COM interface repeatedly, whereas through building a cell
references String I could save a lot of calls to this interface.

Greetz
Fabz
 
P

p45cal

I don't pretend to understand your question, but that's my ignorance
however, within the Excel Application might it help to look at the like
of

Application.International(xlAlternateArraySeparator)
Application.International(xlColumnSeparator)
Application.International(xlListSeparator)
Application.International(xlRowSeparator)

whose values are:

xlAlternateArraySeparator 16
xlColumnSeparator 14
xlDecimalSeparator 3
xlListSeparator 5
xlRowSeparator 15

Also, might it help to use:

Application.UseSystemSeparators = False/True?



The Excel union operator string is different for different locale
(e.g. the
 

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

Top