Options

Create Excel Worksheet

-matrix--matrix- Member Posts: 103
I need to create a report that creat a file excel with different Worksheet.

I write this code:
CLEAR(xlApp);
IF NOT CREATE(xlApp) THEN
   ERROR()
ELSE
   XlWorkBook := xlApp.Workbooks.Add;

XlWorksheet1.Name := 'Worksheet 1';

If i need to export in the same file but create and change worksheet how is the right sintax?

Thanks

Answers

  • Options
    rsaritzkyrsaritzky Member Posts: 469
    I am not sure what you mean when you say you need to "export in the same file but create and change worksheet how is the right syntax?". If you try to explain a little more what you are trying to do, I can try to give you some examples. Do you want to create a new worksheet, then copy the contents of another sheet?

    I'll try to help.

    Ron
    Ron
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
  • Options
    -matrix--matrix- Member Posts: 103
    Thanks Guys but i Solved :D
    xlApp1.ActiveWorkbook.Sheets.Add();
    
    
    XlWorkSheet1 := xlApp1.ActiveSheet;
    XlWorkSheet1.Name := 'Worksheet1 ;
    
    xlApp2ActiveWorkbook.Sheets.Add();
    
    
    XlWorkSheet2:= xlApp1.ActiveSheet;
    XlWorkSheet2Name := 'Worksheet2;
    
    
Sign In or Register to comment.