Streen has asked for the wisdom of the Perl Monks concerning the following question:

Hello,
I have the following code sippet in my Program:
$Chart->SeriesCollection($RoadSeriesIndexLine)->{Values} = "='$roadmap +DataSheet->{Name}'!Z$RoadLine"."S$RoadFirstCol:Z$RoadLine"."S$RoadLas +tCol";

the problem is, this code is only funtioning, if the PC has a german installation of Excel.
The english version will look silightly different.
$Chart->SeriesCollection($RoadSeriesIndexLine)->{Values} = "='$roadmap +DataSheet->{Name}'!R$RoadLine"."C$RoadFirstCol:R$RoadLine"."C$RoadLas +tCol";

See the difference? Z stands for the german word for row and S stands for the german word for Column.

Has anyone a suggestion how I could convert this code in a way, that it is completly independent from the language of the excel installation, or how I can get the language of the excel instalation?
Thanks a lot for help.

Replies are listed 'Best First'.
Re: Win32:OLE -> difference between English and German Excel
by Grygonos (Chaplain) on Jun 30, 2004 at 12:56 UTC

    The Object Browser in Excel yields, The UILanguage property of the Excel.Application object as the possible solution here. When I looked for help on it.. it says it's not relevant to US English versions of Excel .. which makes me think this is what you're looking for. So based on the value of that... have a statement akin to...

    my $h = ($xl->{UILanguage} eq 'German' ? 'Z':'R'); my $v = ($xl->{UILanguage} eq 'German' ? 'S':'C');
    H and V standing for horizontal and vertical.. keeping it neutral to the actual words for row and column in german and english.

      Hi,
      I tried this, but it doesn't work. Something I found was the XlApplicationInternational which should store the constant xlUpperCaseColumnLetter which is different for each country, but I didn't manage it to get the value of this Constant.
      I tried several codes but none of them will function, maybe you can help?
      #my $V = $Excel->International->{xlUpperCaseColumnLetter}; my $lang = $V->XlApplicationInternational->{xlUpperCaseColumnLetter}; print "Column letter: $V\n";

        Below code is tested and verified on ActiveState 5.8.0 with Excel 97'

        #!/Perl/bin/perl use strict; use warnings; use Win32::OLE; use Win32::OLE::Const; my $xl = Win32::OLE->new('Excel.Application'); my $xlConst = Win32::OLE::Const->Load('Microsoft Excel 8.0 Object Libr +ary'); print $xl->International($$xlConst{'xlUpperCaseColumnLetter'}); print $xl->International($$xlConst{'xlUpperCaseRowLetter'});