View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Sérgio Martins Sérgio Martins is offline
external usenet poster
 
Posts: 6
Default Language independent formulas

Sorry I forget to say that A is a constant like:

Private Const A = 1

So that's not the problem.

Sérgio

"Stefi" wrote:

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