C
caicaicaicai
Unregistered / Unconfirmed
GUEST, unregistred user!
我在form上放置了:TExcelApplication,TExcelWorkbook,TExcelWorkSheet控件;
procedure Tform1.button1.click(sender:Tobject);
var temp_worksheet:_WorkSheet;
begin
Try
ExcelApplication1.Connect;
ExcelApplication1.Visible[0]:=True;
ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks.Add(EmptyParam,0));
Temp_Worksheet:=ExcelWorkbook1.WorkSheets.Add(EmptyParam,EmptyParam,EmptyParam,EmptyParam,0) as _WorkSheet;
ExcelWorkSheet1.ConnectTo(Temp_WorkSheet);
Except
showmessage('Could not Create Excel Application!');
End;
end;
procedure Tform1.button2.click(sender:Tobject);
var
ExcelApp, WorkBook, WorkSheet : Variant;
begin
try
ExcelApp := CreateOleObject('Excel.Application');
except
showmessage('Could not Create Excel Application!');
end;
end;
请不要怀疑上面语句的正确性,因为在别人的机器(win2000+office2000)上能通过!能打开EXCEL!
但是在我的机器上却报错:‘拒绝访问’!
我的机器:WIN2000+OFFICE2000;
谁能帮我找找原因?
不要给我重装系统的建议,那样我会完蛋的!
谢谢!
谢谢了!
procedure Tform1.button1.click(sender:Tobject);
var temp_worksheet:_WorkSheet;
begin
Try
ExcelApplication1.Connect;
ExcelApplication1.Visible[0]:=True;
ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks.Add(EmptyParam,0));
Temp_Worksheet:=ExcelWorkbook1.WorkSheets.Add(EmptyParam,EmptyParam,EmptyParam,EmptyParam,0) as _WorkSheet;
ExcelWorkSheet1.ConnectTo(Temp_WorkSheet);
Except
showmessage('Could not Create Excel Application!');
End;
end;
procedure Tform1.button2.click(sender:Tobject);
var
ExcelApp, WorkBook, WorkSheet : Variant;
begin
try
ExcelApp := CreateOleObject('Excel.Application');
except
showmessage('Could not Create Excel Application!');
end;
end;
请不要怀疑上面语句的正确性,因为在别人的机器(win2000+office2000)上能通过!能打开EXCEL!
但是在我的机器上却报错:‘拒绝访问’!
我的机器:WIN2000+OFFICE2000;
谁能帮我找找原因?
不要给我重装系统的建议,那样我会完蛋的!
谢谢!
谢谢了!