H
hbgrape
Unregistered / Unconfirmed
GUEST, unregistred user!
程序如下:
unit cexecl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleServer, Excel2000;
type
TForm1 = class(TForm)
ExcelWorksheet1: TExcelWorksheet;
ExcelWorkbook1: TExcelWorkbook;
ExcelApplication1: TExcelApplication;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$TYPEDADDRESS OFF}
procedure TForm1.Button1Click(Sender: TObject);
begin
ExcelApplication1.Connect;
ExcelApplication1.Visible[0]:=True;
ExcelApplication1.Caption := '应用程序调用 Microsoft Excel';
//ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks.Add(EmptyParam,0));
ExcelApplication1.Workbooks.Open ('c:/a.xls',
EmptyParam,EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,EmptyParam,0);
ExcelApplication1.WorkSheets[2].Activate;
ExcelApplication1.Cells(1,4).Value := '第一行第四列';
//if not ExcelApplication1.ActiveWorkBook.Saved then
ExcelApplication1.ActiveSheet.PrintPreview;
ExcelApplication1.SaveAs('C:/Excel/Demo1.xls');
ExcelApplication1.WorkBooks.Close;
ExcelApplication1.Quit;
ExcelApplication1.Disconnect;
end;
end.
提示错误如下:
Error] cexecl.pas(40): Undeclared identifier: 'Activate'
[Error] cexecl.pas(41): Missing operator or semicolon
[Error] cexecl.pas(43): Undeclared identifier: 'PrintPreview'
[Error] cexecl.pas(44): Undeclared identifier: 'SaveAs'
[Error] cexecl.pas(45): Not enough actual parameters
[Fatal Error] execl.dpr(5): Could not compile used unit 'cexecl.pas'
而且uses中的execl2000在查找时说没有execl2000.pas,why?
我才开始学delphi,标准菜鸟,别笑我啊!
请帮忙!谢谢!
初来,没多少分,先给10分,如果不满意我再加
unit cexecl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleServer, Excel2000;
type
TForm1 = class(TForm)
ExcelWorksheet1: TExcelWorksheet;
ExcelWorkbook1: TExcelWorkbook;
ExcelApplication1: TExcelApplication;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$TYPEDADDRESS OFF}
procedure TForm1.Button1Click(Sender: TObject);
begin
ExcelApplication1.Connect;
ExcelApplication1.Visible[0]:=True;
ExcelApplication1.Caption := '应用程序调用 Microsoft Excel';
//ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks.Add(EmptyParam,0));
ExcelApplication1.Workbooks.Open ('c:/a.xls',
EmptyParam,EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,EmptyParam,0);
ExcelApplication1.WorkSheets[2].Activate;
ExcelApplication1.Cells(1,4).Value := '第一行第四列';
//if not ExcelApplication1.ActiveWorkBook.Saved then
ExcelApplication1.ActiveSheet.PrintPreview;
ExcelApplication1.SaveAs('C:/Excel/Demo1.xls');
ExcelApplication1.WorkBooks.Close;
ExcelApplication1.Quit;
ExcelApplication1.Disconnect;
end;
end.
提示错误如下:
Error] cexecl.pas(40): Undeclared identifier: 'Activate'
[Error] cexecl.pas(41): Missing operator or semicolon
[Error] cexecl.pas(43): Undeclared identifier: 'PrintPreview'
[Error] cexecl.pas(44): Undeclared identifier: 'SaveAs'
[Error] cexecl.pas(45): Not enough actual parameters
[Fatal Error] execl.dpr(5): Could not compile used unit 'cexecl.pas'
而且uses中的execl2000在查找时说没有execl2000.pas,why?
我才开始学delphi,标准菜鸟,别笑我啊!
请帮忙!谢谢!
初来,没多少分,先给10分,如果不满意我再加