Urgent: OLE Automation to Excel 97
The following code snippet works perfectly with Excel 95 but crashes on
the last statement with 'EOleSysErr: Member Not Found' with Excel 97.
I'm using Delphi 3.01 c/s. Both MSExcel and SheetName are declared as
variants. What do I have to do to make this work with Office 97?
Thanks in advance,
Ray Porter
MSExcel := CreateOleObject('Excel.Application');
BookName := 'HRCOMP.XLS';
FileName := strDocsPath + '\' + 'hrcomp.xls';
if (OpenWorkBook(MSExcel, FileName, BookName)) = false then
begin
ShowMessage('Error opening workbook');
exit;
end;
//Show the worksheet
SheetName := 'Sheet1';
MSExcel.Visible := True;
MSExcel.Sheets(SheetName).Select;
--
================================================
Ray Porter
Applications Analyst Programmer
Administrative Information Services, UNC-CH
Phone: 966-5878
email: l...@email.adp.unc.edu
dra...@email.unc.edu
Home Page: http://www.adp.unc.edu/~allrp/
"Meddle not in the affairs of dragons,
for you are crunchy and taste good with ketchup."