I am moving old code from Office 2000 to Office 2010 and have encountered the problem of getting Excel in Autofit columns
The code that worked is as follows:
for x := 1 to LV.Columns.Count do XLApp.Columns[x].EntireColumn.AutoFit;
Where XLApp is a component of TExcelApplication
When I look at VBA, the equivalent code should be
Columns("A:A").EntireColumn.AutoFit
Itโs easy for me to change the code so that the range matches VBA, but this does not seem to be a problem. The error returned by the compiler is -
Class does not have a default property
And the highlight [x] highlighted. Code completion offers no way to select a single column, either an integer or a range.
Any suggestions?
source share