ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Locale issue with union operator string (,) (https://www.excelbanter.com/excel-programming/441610-locale-issue-union-operator-string.html)

Fabz[_3_]

Locale issue with union operator string (,)
 
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.Te xtInfo.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



p45cal[_246_]

Locale issue with union operator string (,)
 

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 likes
of

Application.International(xlAlternateArraySeparato r)
Application.International(xlColumnSeparator)
Application.International(xlListSeparator)
Application.International(xlRowSeparator)

whose values a

xlAlternateArraySeparator 16
xlColumnSeparator 14
xlDecimalSeparator 3
xlListSeparator 5
xlRowSeparator 15

Also, might it help to use:

Application.UseSystemSeparators = False/True?




Fabz;697761 Wrote:

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.Te xtInfo.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



--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?u=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=195152

http://www.thecodecage.com/forumz



All times are GMT +1. The time now is 10:20 AM.

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