N
newcountry
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ComObj;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1 TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var ExcelApp: Variant;
lastRow,lastCol :integer;
begin
ExcelApp := CreateOleObject( 'Excel.Application' );
ExcelApp.Visible := True;
ExcelApp.WorkBooks.Open('c:/EXCEL'); ExcelApp.WorkBooks.ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell,EmptyParam).Activate;
lastRow := ExcelApp.ActiveCell.Row;
lastCol := ExcelApp.ActiveCell.Column;
edit1.Text:=inttostr(lastRow);
edit2.Text:=inttostr(lastCol);
ExcelApp.WorkBooks.Close;
ExcelApp.Quit;
end;
end.
显示
ExcelApp.WorkBooks.ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell,EmptyParam).Activate;函数错误为什么阿?
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ComObj;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1 TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var ExcelApp: Variant;
lastRow,lastCol :integer;
begin
ExcelApp := CreateOleObject( 'Excel.Application' );
ExcelApp.Visible := True;
ExcelApp.WorkBooks.Open('c:/EXCEL'); ExcelApp.WorkBooks.ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell,EmptyParam).Activate;
lastRow := ExcelApp.ActiveCell.Row;
lastCol := ExcelApp.ActiveCell.Column;
edit1.Text:=inttostr(lastRow);
edit2.Text:=inttostr(lastCol);
ExcelApp.WorkBooks.Close;
ExcelApp.Quit;
end;
end.
显示
ExcelApp.WorkBooks.ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell,EmptyParam).Activate;函数错误为什么阿?