Re: row count in Excel (OLE automation)



Sonnich Jensen wrote:
    ExcelApplication := CreateOleObject('Excel.Application');
{    ExcelApplication.Visible := true; { debug only }
    ExcelApplication.Workbooks.Open(OpenDialog2.FileName);
    ExcelApplication.Workbooks[1].WorkSheets[1].Select;

//needed here:
    ProgressBar1.Max :=
ExcelApplication.Workbooks[1].WorkSheets[1].Rowcount?

The Work*** object has a UsedRange property, which returns a Range object. Supposedly, that range is of minimal size, but in my experience, it may include completely empty rows or columns along its edges if those rows or columns were formerly non-empty.


--
Rob
.