Problem with excel workbook

M

marzec.wojciech

Hi,all :)

I have got small script like this below:

use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
use Cwd;

$Win32::OLE::Warn = 3;
my $path = getcwd."/przyklad.xls";
$path =~ tr /\//\\/;
my $excel=Win32::OLE->new('Excel.Application','Quit');
my $book = $excel->Workbooks->Add;#
my $sheet = $book->Worksheets(1);
$book->Sheets->Add;
$book->SaveAs($path);
print $sheet->Name;
#$sheet->Name = "something";
undef $book;
$excel->Quit;
undef $excel;

...and i want to rename one of excel sheet, unfortunetly variable
$sheet->Name is only read-only and when i uncomment this line I will
receive message :
Can't modify non-lvalue subroutine call at excel_basic.pl

I will be grateful for any help.

Thank You
 
L

Lambik

Hi,all :)

I have got small script like this below:

use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
use Cwd;

$Win32::OLE::Warn = 3;
my $path = getcwd."/przyklad.xls";
$path =~ tr /\//\\/;
my $excel=Win32::OLE->new('Excel.Application','Quit');
my $book = $excel->Workbooks->Add;#
my $sheet = $book->Worksheets(1);
$book->Sheets->Add;
$book->SaveAs($path);
print $sheet->Name;
#$sheet->Name = "something";

$sheet->{Name} = "something";
 

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,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top