View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default Language independent formulas

Now I see that your problem doesn't come from language versions but wrong
syntax. The right syntax is
objWs.Cells(6, "A").Formula = "=SUM(A3:A5)"

Stefi


€žSĂ©rgio Martins€ť ezt Ă*rta:

Hi.
Thanks for your help, but I try to use objWs.Cells(6, A).Formula =
"=SUM(A3:A5)" in a Portuguese "Excel" but when I open the "Excel" file the
cell have the error.
I must now the language of the "Excel" in the machine and then use "Soma" or
"SUM" if the "Excel" is Portuguese or "English"?
Thanks.

Best regards,
Sérgio Martins

"Stefi" wrote:

If you run the code in a Portuguese Excel then you should use
objWs.Cells(6, A).FormulaLocal = "=SOMA(A3:A5)"

If you use in an Excel of any language
objWs.Cells(6, A).Formula = "=SUM(A3:A5)"
then it'll translate it to its national language equivalent, e.g.
=SOMA(A3:A5) in case of a Portuguese version, or =SZUM(A3:A5) in my Hungarian
version, so this is the way you are looking for.

You cannot use
objWs.Cells(6, A).Formula = "=SOMA(A3:A5)" in an English version.

Regards,
Stefi

€žSergio Martins€ť ezt Ă*rta:

Hi.
I have a small program that creates by code a €śExcel€ť file.
One of the cells is fill with a sum formula.

My problem is:

The program can be executed in machines that have €śExcel€ť in Portuguese or
€śExcel€ť in English, if the code fill the cell with €śSoma()€ť when the €śExcel€ť
file is created in Portuguese €śExcel€ť the file is valid in any €śExcel€ť,
however if the file is created in English €śExcel€ť the cell have an error.

I also try to set the formula like €śSUM()€ť but in this case I got the error
if the file is created in Portuguese €śExcel€ť.

To create de formula in the cell I use the following code:
objWs.Cells(6, A).Formula = "=SOMA(A3:A5)"

Can anyone explain, how can I create a €śExcel€ť file with formulas that are
independent from the language of the €śExcel€ť in the machine that create the
file?

Thanks in advance.

Best regards
Sérgio Martins