PHP & COM

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
edoardor
Forum Newbie
Posts: 7
Joined: Sun Aug 11, 2002 7:05 am
Location: Italy

PHP & COM

Post by edoardor »

I have e code like this:

Code: Select all

$workbook = "c:\\test.xls";
    $ex = new COM("Excel.application") or Die ("Did not connect");
    $ex->application->Workbooks->Open($workbook) or Die ("Did not open");
    $ex->Application->ActiveWorkbook->RefreshAll(); // this refresh tables
    $ex->Application->ActiveWorkbook->PrintOut();
    $ex->application->ActiveWorkbook->Close(false);    
    $ex->Quit();
    $ex->Release();
    $ex = null;
every time that I launch this program remains opened a process in taskmanager. if launch 20 times I find 20 EXCEL running

Someone knows what can seems in order to obviate to this problem or to say me where I mistake?

thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I'm not sure but maybe:
If unsaved workbooks are open when you use this method, Microsoft Excel displays a dialog box asking whether you want to save the changes. You can prevent this by saving all workbooks before using the Quit method or by setting the DisplayAlerts property to False. When this property is False, Microsoft Excel doesn’t display the dialog box when you quit with unsaved workbooks; it quits without saving them.

Code: Select all

$ex->Application->DisplayAlerts = False;
and
expression.Quit
expression Required. An expression that returns an Application object.

Code: Select all

$ex->Application->Quit();
edoardor
Forum Newbie
Posts: 7
Joined: Sun Aug 11, 2002 7:05 am
Location: Italy

Post by edoardor »

Hi,
thanks for the information that you have given to me, I have made the modifications but it does not change null.

I have found this bug report in PHP , therefore it does not remain that to wait for version 4.3

Good job and thanks
Post Reply