The following code causes an error on second line, Windows 2000/XP with Office 2000/XP. with Excel.Application.9 & Excel.Application.10 I am not sure of the others. is there anything I do wrong here ?
declare
application OLE2.OBJ_TYPE;
workbook OLE2.OBJ_TYPE;
workbooks OLE2.OBJ_TYPE;
worksheet OLE2.OBJ_TYPE;
worksheets OLE2.OBJ_TYPE;
cell OLE2.OBJ_TYPE;
args OLE2.List_Type;
begin
application:=OLE2.CREATE_OBJ('Excel.Application');
workbooks:=OLE2.INVOKE_OBJ(application, 'Workbooks');
OLE2.Set_Property(application,'Visible', 'True');
workbook:=OLE2.INVOKE_OBJ(workbooks,'Add');
worksheets:=OLE2.INVOKE_OBJ(workbook, 'Worksheets');
worksheet:=OLE2.INVOKE_OBJ(worksheets,'Add');
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 4);
OLE2.ADD_ARG(args, 2);
cell:=OLE2.Invoke_Obj(worksheet, 'Cells', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.Set_Property(cell, 'Value', 'Hello Excel!');
OLE2.Release_Obj( application );
exception
when others then
OLE2.Release_Obj( application );
message('errors');
end;
declare
application OLE2.OBJ_TYPE;
workbook OLE2.OBJ_TYPE;
workbooks OLE2.OBJ_TYPE;
worksheet OLE2.OBJ_TYPE;
worksheets OLE2.OBJ_TYPE;
cell OLE2.OBJ_TYPE;
args OLE2.List_Type;
begin
application:=OLE2.CREATE_OBJ('Excel.Application');
workbooks:=OLE2.INVOKE_OBJ(application, 'Workbooks');
OLE2.Set_Property(application,'Visible', 'True');
workbook:=OLE2.INVOKE_OBJ(workbooks,'Add');
worksheets:=OLE2.INVOKE_OBJ(workbook, 'Worksheets');
worksheet:=OLE2.INVOKE_OBJ(worksheets,'Add');
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 4);
OLE2.ADD_ARG(args, 2);
cell:=OLE2.Invoke_Obj(worksheet, 'Cells', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.Set_Property(cell, 'Value', 'Hello Excel!');
OLE2.Release_Obj( application );
exception
when others then
OLE2.Release_Obj( application );
message('errors');
end;