Options

Export to Excel : Add data to new worksheet

lynhthilynhthi Member Posts: 15
Hi All !
I make 1 report to export Sales inv. Line and Sales Cr. memo Line to Excel.
I create new workbook and enter Sales inv. line data to first worksheet. How do I enter Sales. Credit memo Line data to next worksheet ?
Can You Help Me.
Thanks

Comments

  • Options
    alanperualanperu Member Posts: 23
    Hi,

    Try this:

    ExcelSheet := xlSheet.Item(1);
    ExcelSheet.Activate;

    Where ExcelSheet is the WorkSheet object and xlSheet is the sheets object. 1 is the worksheet index.

    Hope this helps.
  • Options
    afarrafarr Member Posts: 287
    In the Excel Buffer table, there is a function Create Sheet that writes the contents of the table to an Excel sheet; I wrote another function that first adds a new sheet:



    CreateNewSheet(SheetName,ReportHeader,CompanyName,UserID2)

    XlWrkSht := XlWrkBk.Worksheets.Add;
    CreateSheet(SheetName,ReportHeader,CompanyName,UserID2);


    (The parameters I use when calling it are usually:
    SheetName, '', COMPANYNAME, USERID)
    Alastair Farrugia
  • Options
    lynhthilynhthi Member Posts: 15
    :) It works.
    Thanks you.
  • Options
    TirtaTirta Member Posts: 53
    hi lynhthi,
    which one has worked? The codes from afar or alanperu?
Sign In or Register to comment.