From: Fabz on 13 Apr 2010 05:44 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
From: p45cal on 13 Apr 2010 06:45 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(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? F a b z ; 6 9 7 7 6 1 W r o t e : > 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 -- p45cal *p45cal* ------------------------------------------------------------------------ p45cal's Profile: http://www.thecodecage.com/forumz/member.php?u=558 View this thread: http://www.thecodecage.com/forumz/showthread.php?t=195152 http://www.thecodecage.com/forumz
|
Pages: 1 Prev: update user name in excel on open Next: Find a Item & Copy the Data |