Problem with excel workbook

Discussion in 'Perl Misc' started by marzec.wojciech@gmail.com, Jul 26, 2007.

  1. Guest

    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
     
    , Jul 26, 2007
    #1
    1. Advertising

  2. Lambik Guest

    <> wrote in message
    news:...
    > 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";

    > 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
    >
     
    Lambik, Jul 26, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. philip herman

    'Document not saved' error - excel workbook

    philip herman, Jul 11, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    5,470
    philip herman
    Jul 11, 2003
  2. =?Utf-8?B?SmltIEhlYXZleQ==?=

    Excel _WorkBook vs. Excel.Workbook

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Sep 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,677
    Steve C. Orr [MVP, MCSD]
    Sep 29, 2004
  3. Winshent
    Replies:
    0
    Views:
    1,978
    Winshent
    Nov 3, 2004
  4. Yelena Kaplun
    Replies:
    1
    Views:
    5,218
    Yelena Kaplun
    Jan 19, 2005
  5. Yelena Kaplun
    Replies:
    0
    Views:
    155
    Yelena Kaplun
    Jan 14, 2005
Loading...

Share This Page