MsExcel := CreateOleObject('Excel.Application');
WorkBook := MsExcel.Application;
if openDialog1.Execute then
Fname:=openDialog1.FileName;
WorkBook.WorkBooks.Open(Fname);
WorkBook.Visible := False;
MsExcel.Visible := True;
WorkSheet := WorkBook.ActiveSheet;
row:=WorkSheet.UsedRange.Rows.count;
col:=WorkSheet.UsedRange.Columns.Count;