Board index » delphi » Problem Converting Code From Excel95 to Excel2000

Problem Converting Code From Excel95 to Excel2000

Anyone know why the following works with Delphi 5 and Excel95 and
not Excel2000? The error message is "Member Not Found":

var
  ExcelApp: variant;
  Range: OleVariant;
  WS: OleVariant;
begin

  try
    ExcelApp := GetActiveOleObject('Excel.Application'); { uses ComObj }
  except
    ExcelApp := CreateOleObject('Excel.Application'); { uses ComObj }
  end;

 ExcelApp.Range('A1', 'A5').EntireRow.Insert; { << - Error - Not Working
for Excel2000 }

 WS := ExcelApp.Activesheet;
 WS.Columns('E1:E1').ColumnWidth := 10.5;{ << - Error -  Not Working for
Excel2000 }

Thanks

-- Alex

 

Re:Problem Converting Code From Excel95 to Excel2000


<<Alex:
Anyone know why the following works with Delphi 5 and
Excel95 and not Excel2000?

Quote

I've no idea why it worked with Excel95, but with Excel97+
that should be

  Excel.Range['A1', 'A5'].EntireRow.Insert;
  Excel.ActiveSheet.Columns['E:E'].ColumnWidth := 100;

--
Deborah Pate (TeamB) http://delphi-jedi.org

  TeamB don't see posts sent via Google or ISPs
  Use the real Borland server: newsgroups.borland.com
  http://www.borland.com/newsgroups/genl_faqs.html

Re:Problem Converting Code From Excel95 to Excel2000


Thanks again Deborah !

-- Alex

Quote
"Deborah Pate (TeamB)" wrote:

> <<Alex:
> Anyone know why the following works with Delphi 5 and
> Excel95 and not Excel2000?

> I've no idea why it worked with Excel95, but with Excel97+
> that should be

Other Threads