AddNewSheet(SheetName : Text[250]) CurrentRow := 0; CurrentCol := 0; XlWrkShtWriter := XlWrkBkWriter.AddWorksheet(SheetName); IF SheetName <> '' THEN BEGIN XlWrkShtWriter.Name := SheetName; ActiveSheetName := SheetName; END; SetActiveSheet(SheetName : Text[250]) XlWrkShtWriter := XlWrkBkWriter.GetWorksheetByName(SheetName); IF SheetName <> '' THEN BEGIN XlWrkShtWriter.Name := SheetName; XlWrkShtWriter.Name := SheetName; END; XlWrkSht := XlWrkShtWriter.Worksheet;
FAMJobsExportExcel; // This function resets the buffer table and adds columns ExcelBuffer.CreateBook(ExcelFileName, 'testas'); ExcelBuffer.AddNewSheet('lapastt1'); ExcelBuffer.SetActiveSheet('lapastt1', ExcelFileName); ExcelBuffer.WriteSheet('', COMPANYNAME, USERID); DocumentsExportExcel; // This function resets the buffer table and adds columns ExcelBuffer.AddNewSheet('lapastt2'); // This line is probably responsible for the error ExcelBuffer.SetActiveSheet('lapastt2', ExcelFileName); ExcelBuffer.WriteSheet('', COMPANYNAME, USERID);
Answers
Perhaps, there is a call of CLEAR(ExcelBuffer) in DocumentsExportExcel function.
If I'm not mistaken, ExcelBuffer.RESET can also clear variables.
Try to avoid call of these functions when book is already created, but not finished.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!