Please have a look at the following source code and tell me what could be

wrong. I'm trying to use English worksheet function and number formatting in

non-English version of MS Excel.



Has anybody an idea why single cell calls are interfaced correctly but range

calls are not?

It's quite ineffective to fill in a whole sheet cell by cell, isn't it?





use Win32::OLE qw( with );

use Win32::OLE::NLS qw(:DEFAULT :LANG :SUBLANG);

use strict;



# I believe this sets English environment

my $lgid = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT);

$Win32::OLE::LCID = MAKELCID($lgid);



my $excel;      # MS Excel : OLE variable

my $book;       # Workbook : OLE variable

my $sheet;       # Worksheet : OLE variable

my $area;       # Range : OLE variable



  $excel = Win32::OLE->new('Excel.Application');

  $excel->{Visible} = 1;

  $excel->Workbooks->Add;

  $book = $excel->Workbooks(1);

  $sheet = $book->Worksheets(1);



# It works here, I can use decimat dot and IF function........

  $sheet->Range("A1")->{Formula} = '1.2222';

  $sheet->Range("B1")->{Formula} = '=2*1.5';

  $sheet->Range("C1")->{Formula} = '=IF(A1>0,B1,A1)';



# Now I'm trying to use Czech numbers and funtion and it's working

too.......

  $sheet->Range("A2:C3")->{Formula} = (['1,2222', '=2*1,5',

'=KDYŽ(A2>0;B2;A2)'],

                                       ['1,2222', '=2*1,5',

'=KDYŽ(A3>0;B3;A3)']);



# Now I'm trying to use English numbers and funtion but IT IS NOT WORKING

  $sheet->Range("A4:C5")->{Formula} = (['1.2222', '=2*1.5',

'=IF(A4>0,B4,A4)'],

                                       ['1.2222', '=2*1.5',

'=IF(A5>0,B5,A5)']);



-- Petr Smejkal



_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to