Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why Excel doesn't close at Task Manager ?

Status
Not open for further replies.

ekobudy

Programmer
Jul 28, 2002
42
ID
Here is My Script :

declare
apps ole2.obj_type;
books ole2.obj_type;
book ole2.obj_type;
sheets ole2.obj_type;
sheet ole2.obj_type;
cell ole2.obj_type;
args ole2.obJ_type;
begin
apps:=ole2.create_obj('excel.application');
Ole2.set_property(apps,'Visible',False);
books:=ole2.get_obj_property(apps,'workbooks');
book:=ole2.get_obj_property(books,'Add');
sheets:=ole2.get_obj_property(book,'worksheets');
sheet:=ole2.get_obj_property(sheets,'add');

args:=OLE2.Create_ArgList;
Ole2.add_arg(args,1);
Ole2.Add_arg(args,'A');
cell:=Ole2.Get_obj_property(sheet,'Cells',args);
Ole2.Destroy_argList(args);
ole2.set_property(cell,'value','Test Excel');

OLE2.set_property(apps,'Displayalerts',FALSE);
args:=OLE2.Create_ArgList;
Ole2.Add_arg(args,'c:\OLETEST.xls');
Ole2.Invoke(sheet,'Save',args);
Ole2.destroy_arglist(args);

ole2.release_obj(cell);
ole2.release_obj(sheet);
ole2.release_obj(sheets);
ole2.release_obj(book);
ole2.release_obj(books);
ole2.release_obj(apps);
end;

But, when i look at Task Manager EXCEL.EXE still open. Could someone give me clue ?
 
I'm at home so I can't test this, but my guess is the app is still active. I think you either need to quit the app or make it visible so that you can exit through Excel.
ole2.invoke(apps, 'Quit');

 
thanks again.
BTW, do you have OLE2.Automation list ?
so i can explore it by myself.
 
I'm not sure what you mean by OLE2.Automation list. Most of the stuff I've done is by recording macro's in either Excel or Word, and trying to change the VBA code into it's OLE2 equivalent.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top