I work with Excel in Delphi 7 via OLE. How to create a file, change something in it and close it, there are no problems. But I also need to open the Excel file saved in the database (MSSQL) for viewing. I work with Excel like this:
ExlApp := CreateOleObject('Excel.Application'); try ExlApp.Workbooks.Open(XLSFile); Sheet := ExlApp.Workbooks[ExtractFileName(XLSFile)].WorkSheets[1]; ... finally ExlApp.DisplayAlerts := false; ExlApp.ActiveWorkbook.Close(SaveChanges:=False); ExlApp.Application.Quit; Sheet := Unassigned; ExlApp := Unassigned; end; If we only open the Excel file, that is, a piece of code:
ExlApp.DisplayAlerts := false; ExlApp.ActiveWorkbook.Close(SaveChanges:=False); ExlApp.Application.Quit; Sheet := Unassigned; ExlApp := Unassigned; will be absent, is it necessary to clear the memory later (when the user closes the Excel document) allocated for ExlApp and if so, in what way?