这里有一个打开Excel文件的例子,可以参考一下 function TfrmZSNewSum.OpenSum(sumtitle: string): boolean; var ExcelApp: Variant; begin if FileExists('.\data\'+sumtitle+'.xls') then begin ExcelApp:=CreateOleObject('Excel.Application'); ExcelApp.Visible :=True; ExcelApp.WorkBooks.Open('.\data\'+sumtitle+'.xls'); end else begin Application.Messagebox('对不起,没有相应的文件,请先生成统计表再打开!','提示',MB_OK+MB_ICONQUESTION); end;end;
function TfrmZSNewSum.OpenSum(sumtitle: string): boolean;
var
ExcelApp: Variant;
begin
if FileExists('.\data\'+sumtitle+'.xls') then
begin
ExcelApp:=CreateOleObject('Excel.Application');
ExcelApp.Visible :=True;
ExcelApp.WorkBooks.Open('.\data\'+sumtitle+'.xls');
end
else
begin
Application.Messagebox('对不起,没有相应的文件,请先生成统计表再打开!','提示',MB_OK+MB_ICONQUESTION);
end;end;
zx:=CreateOleObject('word.Application');
WordApp.Visible:=True;
WordDoc.ConnectTo(WordApp.Documents.Add(EmptyParam,EmptyParam,EmptyParam,EmptyParam));就行了!
word:variant;
begin
word:=createoleobject('wold.application');
word.visible:=true;
word.documents.add;
word.selection.typetext('test');
end;
谢谢访问我的网站 http://www.zgzy.net.cn