Board index » delphi » Multiple sheets in Excel
Lorne
![]() Delphi Developer |
Lorne
![]() Delphi Developer |
Multiple sheets in Excel2005-09-07 08:26:04 PM delphi92 At the moment I have: var XLApp, Sheet, Data: OLEVariant; begin try XLApp := CreateOleObject('Excel.Application'); XLApp.Visible := False; XLApp.Workbooks.Add(xlWBatWorkSheet); Sheet := XLApp.Workbooks[1].WorkSheets[1]; ....code to import data ... etc This creates a workbook with one sheet, but how do I create a second sheet and get access to it? |
Oliver Townshend
![]() Delphi Developer |
2005-09-07 08:42:58 PM
Re:Multiple sheets in ExcelQuotevar |
Lorne
![]() Delphi Developer |
2005-09-07 09:49:08 PM
Re:Multiple sheets in Excel
"Oliver Townshend" <oliveratzipdotcomdotau>writes
Quote>var I have now found the error came from a stupid typo 2 lines later that meant my code worked only for 1 sheet - and since it did work before I added the line for another sheet I assumed that was the problem and never noticed the de{*word*81} cursor was 2 lines away :( |
Mike Shkolnik
![]() Delphi Developer |
2005-09-07 10:30:29 PM
Re:Multiple sheets in Excel
XLApp := CreateOleObject('Excel.Application');
XLBook := XLApp.Workbooks.Add; Sheet := XLBook.Sheets.Add; "Lorne" <XXXX@XXXXX.COM>writes QuoteAt the moment I have: |