add Method of Sheets Class Failed

Hi All,

         When I have generate Multiple excel Sheet Using .Net InterOpratibility, I have  got error of "add Method of Sheets Class Failed". I have using following code ..

 

xlapp := xlapp.ApplicationClass;

xlworkbook := xlapp.Workbooks.Add('');

xlWorkSheet := xlworkbook.ActiveSheet;

xlWorkSheet.Name := 'Sheet1';

xlWorkSheet1 := xlworkbook.Worksheets.Add('','',1,'');

xlWorkSheet1.Name := 'Sheet2';

xlapp.Visible := TRUE;

Related