Win32::OLE check if excel is English or Swedish

P

peter.moller

Does anyone know how to check if the Excel I'm talking to
with Win32::OLE is english or swedish?

The reason is that I want to add some simple formulas as
values in a few cells.

For example:
An english version wants =SUM('A1:A42) or =AVERAGE('A1:A42)
and a swedish version wants =SUMMA('A1:A42) or =MEDEL('A1:A42);


PMoller
 
B

Brian Helterline

Does anyone know how to check if the Excel I'm talking to
with Win32::OLE is english or swedish?

The LanguageSettings Property looks promising: (from Excel VBA)

Returns the LanguageSettings object, which contains information about the
language settings in Microsoft Excel. Read-only.
expression.LanguageSettings
expression Required. An expression that returns one of the objects in the
Applies To list.
Example
This example returns the language identifier for the language you selected
when you installed Microsoft Excel.
Set objLangSet = Application.LanguageSettings
MsgBox objLangSet.LanguageID(msoLanguageIDInstall)

Translation into Perl left as an exercise ;)
 
L

Lambik

Brian said:
The LanguageSettings Property looks promising: (from Excel VBA)

Returns the LanguageSettings object, which contains information about the
language settings in Microsoft Excel. Read-only.
expression.LanguageSettings
expression Required. An expression that returns one of the objects in the
Applies To list.
Example
This example returns the language identifier for the language you selected
when you installed Microsoft Excel.
Set objLangSet = Application.LanguageSettings
MsgBox objLangSet.LanguageID(msoLanguageIDInstall)

Translation into Perl left as an exercise ;)
#!/usr/bin/perl
use strict;
use Win32::OLE;

$Win32::OLE::Warn = 3;
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')||
Win32::OLE->new('Excel.Application', 'Quit');
my $lang = $Excel->LanguageSettings->LanguageID(3);
print "$lang";
 
P

peter.moller

Lambik said:
#!/usr/bin/perl
use strict;
use Win32::OLE;

$Win32::OLE::Warn = 3;
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')||
Win32::OLE->new('Excel.Application', 'Quit');
my $lang = $Excel->LanguageSettings->LanguageID(3);
print "$lang";

Works wonderful. Thanks alot.
This gave me 1033 on one computer and 1053 on the other.

Some mouse clicking in the MS Object Browser
gave msoLanguageIDEnglishUS = 1033
and msoLanguageIDSwedish = 1053

and thats all I need.

Thanks again.

PMoller
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top