Home: Perl Programming Help: Win32 Programming Help:
Excel doesnt show up



atulbhai
newbie

Nov 22, 2001, 3:12 AM


Views: 8557
Excel doesnt show up

Hi Perl Champs,

following statement creates new instance of excel application. But i dont see any excel being activated on my desktop?
any idea why so and what went wrong? useful pointers will be highly appreaciated.

$ex = Win32::OLE->new('Excel.Application') or die "oops\n";

thanks a lot,
-atul.



fashimpaur
User

Dec 3, 2001, 12:25 PM


Views: 8547
Re: Excel doesnt show up

You might want to try to make it visible.

Try this example and then see if it doesn't do what you are trying to accomplish.

use Win32::OLE;
use Win32::OLE::Const;
my $ex = Win32::OLE->new('Excel.Application');
my $xl = Win32::OLE::Const->Load($ex);
$ex->{Visible} = 1;
$x = 0;
$book = $ex->Workbooks->Add();
$sheet = $book->Worksheets(1);
$row = 1;
while ($x < 1000) {
for ($col = 1; $col <= 10; ++$col){
$sheet->Cells($row,$col)->{Value} = $x;
$x += 1;
}
$row++;
}
$book->SaveAs("c:/perl.xls");
$ex->Quit;

Dennis

$a="c323745335d3221214b364d545a362532582521254c3640504c37292f493759214b3635554c3040606a0",print unpack"u*",pack "h*",$a,"\n\n"


Panjka
stranger

Dec 5, 2001, 11:41 PM


Views: 8543
Re: Excel doesnt show up

Thank you, Dennis!

This morning I was going to post practically the same question to the Forum (When using Win32::OLE, I could not see the Internet Explorer window, although the OLE object was generated successfully and I could access its methods). And how great it is when you have the answer before asking the question itself!

Pavel (Panjka).