Dave,
I attack this a little differently, I allow the excel to create sheet1
sheet2 and sheet3. which I believe are created by default. First create all
the sheets that you need by looping around

    $Sheet           = $Book->Worksheets->Add;
    $Sheet->{Name}   = "$NEW_NAME";

Then delete all the sheets that start with "sheet"

    $SheetTabName  = $Book-> Worksheets($_)->{Name};
    foreach ( 1...$SheetCnt)
    {
        $SheetTabName  = $Book-> Worksheets($_)->{Name};
        if  ( $SheetTabName =~ /^sheet/i )
        {
            $Book->Worksheets("$SheetTabName")->Delete;
        }
    }

Later,
Matt Ross
Motorola
Configuration Management ePIMS

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hsu,
David
Sent: Friday, August 05, 2005 7:58 AM
To: Dave Kazatsky
Cc: Perl-Win32-Users@listserv.ActiveState.com;
[EMAIL PROTECTED]
Subject: RE: Win32:OLE Excel

Removing the () seems to work, but only if I am adding one worksheet.
I am using a For Loop to add multiple sheets, but all the other sheets are
default named "Sheet2", "Sheet3", etc... So, some more investigation.

Thanks,
David

-----Original Message-----
From: Dave Kazatsky [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 04, 2005 1:47 PM
To: Hsu, David
Cc: Perl-Win32-Users@listserv.ActiveState.com;
[EMAIL PROTECTED]
Subject: RE: Win32:OLE Excel


David,

I have a script with almost the exact same code and it works correctly.
Try removing the parens from your add statement and see if that makes a
difference.

Original Code:
$Worksheet = $Workbook->Worksheets()->Add();
$Worksheet->{Name} = "test $i";

Becomes:
$Worksheet = $Workbook->Worksheets->Add;
$Worksheet->{Name} = "test $i";

HTH.

Dave Kazatsky
Senior Middleware Engineer
W. (908) 575-6947
C. (973) 865-8106


|---------+------------------------------------------------->
|         |           "Hsu, David" <[EMAIL PROTECTED]>    |
|         |           Sent by:                              |
|         |           [EMAIL PROTECTED]|
|         |           veState.com                           |
|         |                                                 |
|         |                                                 |
|         |           08/04/2005 01:17 PM                   |
|         |                                                 |
|---------+------------------------------------------------->
 
>-----------------------------------------------------------------------
-----------------------|
  |
|
  |       To:       "Ken Barker" <[EMAIL PROTECTED]>,
|
  |        Perl-Win32-Users@listserv.ActiveState.com
|
  |       cc:
|
  |       Subject:  RE: Win32:OLE Excel
|
 
>-----------------------------------------------------------------------
-----------------------|





Ken,
I am using Win32::OLE.  Add_worksheet uses the Spreadsheet:WriteExcel
module.

Thanks,
David

-----Original Message-----
From: Ken Barker [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 04, 2005 12:07 PM
To: Hsu, David; Perl-Win32-Users@listserv.ActiveState.com
Subject: RE: Win32:OLE Excel

Try

$ws1 = $workbook->add_worksheet('worksheetname');



Ken Barker
IT Lead
Americall Group, Inc
314-213-7927
[EMAIL PROTECTED]


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Hsu, David
Sent: Thursday, August 04, 2005 10:23 AM
To: Perl-Win32-Users@listserv.ActiveState.com
Subject: Win32:OLE Excel


Hi,
Does someone know of another method of naming the Excel sheets?
Currently I am using:
...
$Worksheet = $Workbook->Worksheets()->Add();
$Worksheet->{Name} = "test $i";
...

The sheet names are still "Sheet1", "Sheet2", etc...

Thanks,
David

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

______________________________________________________________________
This e-mail has been scanned by MCI Managed Email Content Service, using
Skeptic(tm) technology powered by MessageLabs. For more information on
MCI's Managed Email Content Service, visit http://www.mci.com.
______________________________________________________________________

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs








The information contained in this message may be CONFIDENTIAL and is for
the intended addressee only.  Any unauthorized use, dissemination of the
information, or copying of this message is prohibited.  If you are not
the intended addressee, please notify the sender immediately and delete
this message.


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to