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 ?
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 ?