David,
Works like a charm - Thanks.
Ed Ewen
(404) 575-3531
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
-----Original Message-----
From: David Lewis [SMTP:[EMAIL PROTECTED]]
<mailto:[SMTP:[EMAIL PROTECTED]]>
Sent: Wednesday, May 10, 2000 3:28 PM
To: Ewen, Ed
Subject: Re: How do I create a new Excel file
To create a new Excel workbook, use the following command:
$book = $ex->Workbooks->Add();
then, to save it, use:
$book ->SaveAs('path\test.xls');
----- Original Message -----
From: Ewen, Ed <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
To: Perl-Win32-Users Mailing List
<[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> >
Sent: Wednesday, May 10, 2000 1:25 PM
Subject: How do I create a new Excel file
> Hi all,
>
> The following code works with an existing .xls file, but I can't
seem to
> create a new one. I've tried prefixing the filename >testfile.xls
and
using
> New(Excel.Workbook) - all to no avail.
> Any ideas? TIA
>
> use Win32::OLE;
> $ex = Win32::OLE->GetActiveObject('Excel.Application');
> if (!$ex) {
> $ex = Win32::OLE->new('Excel.Application', sub {$_[0]->Quit;})
> or die "Cannot create excel session - $!";
> }
>
> $book = $ex->Workbooks->Open('test.xls');
>
> $book->Worksheets(1)->Cells(1,1)->{Value} = 'Hello';
> $book->Worksheets(1)->Cells(1,2)->{Value} = 'World';
> $book->save;
>
>
>
> Ed Ewen
> (404) 575-3531
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
<mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
>
>
> ---
> You are currently subscribed to perl-win32-users as:
[EMAIL PROTECTED]
> To unsubscribe, forward this message to
> [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
> For non-automated Mailing List support, send email to
> [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
>
>
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]