Board index » cppbuilder » Different languages and formulas in Excel

Different languages and formulas in Excel

Hello,

I am using BCB 5.0 to automate excel.

How would I proper decide which language is setup for excel, so I can pass
the appropriate formula. I am having difficulties with the formulas. There
is some difference between formulas on a german machine and an english
machine.

i.e.

  =COUNTIF(B1:B34, "X")
  =Z?HLENWENN(B1:B34; "X")

Not only that the commands are translated to german, the english formula
wants a "," and in the german version it wants a ";".

Since my application is supposed to be running on an english and a german
machine I need to make this decision. How would I proper do that?

The spreadsheets that I am creating do not have this problem. They work fine
on both machines, english and german.

Thanks a lot for your help
Roland

 

Re:Different languages and formulas in Excel


Quote
> Not only that the commands are translated to german, the english formula
> wants a "," and in the german version it wants a ";".

It dependent of "local settings" of Windows... Take it to consideration and
have fun!

Gnum

Re:Different languages and formulas in Excel


Thanks Gnum,

I was playing a little with GetLocaleInfo and found the solution.

Thanx again
Roland

Quote
"Gnum" <m...@oscreator.com> wrote in message

news:3ead4437@newsgroups.borland.com...
Quote
> > Not only that the commands are translated to german, the english formula
> > wants a "," and in the german version it wants a ";".
> It dependent of "local settings" of Windows... Take it to consideration
and
> have fun!

> Gnum

Re:Different languages and formulas in Excel


Quote

>  =COUNTIF(B1:B34, "X")
>  =Z?HLENWENN(B1:B34; "X")

Where exactly do you use the formulas? Do you write them to a cell through automation? You could use the Formula property to assign the English function regardless of the Excel version.
There is also a FormulaLocal property that uses the translated function name. So for example for a German Excel the Formula property is "=SUM(A1:A4)" and the FormulaLocal property for the same cell is "=SUMME(A1:A4)".
In a macro the English function name will also work instead of the localized name.
For other things like formating dates or currency you should take a look at the Application.International(...) function of excel.
Quote
"RoRi" <roris...@t-online.de> wrote:
>Hello,

>I am using BCB 5.0 to automate excel.

>How would I proper decide which language is setup for excel, so I can pass
>the appropriate formula. I am having difficulties with the formulas. There
>is some difference between formulas on a german machine and an english
>machine.

>i.e.
>Not only that the commands are translated to german, the english formula
>wants a "," and in the german version it wants a ";".

>Since my application is supposed to be running on an english and a german
>machine I need to make this decision. How would I proper do that?

>The spreadsheets that I am creating do not have this problem. They work fine
>on both machines, english and german.

>Thanks a lot for your help
>Roland

Other Threads