There is one file in Excel there roughly speaking a report on form X. In the program itself, in certain fields (for example TEdit) I fill in the data that must be replaced in the file in a specific cell in a specific sheet (only 11 sheets). I understood approximately how to do this in the active sheet:

Excel := CreateOleObject('Excel.Application'); Excel.Workbooks.Open('C:\1.xls'); Excel.Range['F7']:='Привет'; Excel.save; Excel.ActiveWorkbook.Close; Excel.Application.Quit; 

But how to make the remaining sheets? (or maybe I'm doing it wrong, or maybe some more convenient non-standard component)

    1 answer 1

    For example:

     WorkSheet := Excel.Workbooks[1].WorkSheets['Лист1']; WorkSheet.Cells[1,1]:='Пока'; 

    Install help in the office for VBA, it describes the hierarchy of classes and methods. Everything is pretty transparent.

    • Is there a clear documentation of this? or at least write here then after all the changes, save everything correctly, close and then open the file itself in Excel (although the last one understood how) - zerpico
    • Open Excel. Press Alt-F11. Then there is the F1 Excel Excel Reference Reference (I talked about this help, I had to install it before installing the office, now the help is available online, it has become easier). You can write a macro there, debug it. then move to delphi. Shl I ask simpler, I missed your comment, did not immediately respond. - Yura Ivanov