Hi all,
I have a problem to catch up with new version of excel buffer. I'm creating a simple codeunit to export to excel.
xb - Record: excel buffer
This is the code:
OnRun() ------------------------------ xb.DELETEALL(FALSE); xb.ClearNewRow; xb.NewRow; xb.AddColumn ('text1',FALSE,'',FALSE,FALSE,FALSE,'',xb."Cell Type"::Text); xb.CreateBook('s1'); xb.WriteSheet('2','',''); xb.DELETEALL(FALSE); xb.GiveUserControl; ERROR('');
but nothing appears. no result. no excel is showing. Can anyone tell me what's wrong?
Thank you for any inputs.
*This post is locked for comments
hi all, i think i have got the answer for this:
joemarselo.wordpress.com/.../my-version-of-multiple-excel-sheets-using-excel-buffer
thank you Vishal, thank you Suresh. both suggestions works well for 1 sheet.
what to do to make multi sheets?
my codes is:
xb.DELETEALL(FALSE); xb.SetUseInfoSheet; xb.ClearNewRow; xb.NewRow; xb.AddInfoColumn ('info1',FALSE,'',FALSE,FALSE,FALSE,'',xb."Cell Type"::Text); xb.ClearNewRow; xb.NewRow; xb.AddColumn ('text1',FALSE,'',FALSE,FALSE,FALSE,'',xb."Cell Type"::Text); xb.CreateBook('s1'); xb.WriteSheet('','',''); xb.DELETEALL(FALSE); xb.ClearNewRow; xb.NewRow; xb.AddColumn ('text2',FALSE,'',FALSE,FALSE,FALSE,'',xb."Cell Type"::Text); xb.WriteSheet('','',''); xb.DELETEALL(FALSE); xb.CloseBook; xb.OpenExcel; xb.GiveUserControl; ERROR('');
that code is wrong, giving error message. no excel is showing. Can anyone tell me what's wrong?
Thank you for any inputs.
After adding the column in the excel buffer you don't need to use CreateBook ,WriteSheet functions and then delete. Use CreateBookAndOpenExcel funciton in the excel buffer or Here is the code
xb.DELETEALL(FALSE);
xb.ClearNewRow;
xb.NewRow;
xb.AddColumn ('text1',FALSE,'',FALSE,FALSE,FALSE,'',xb."Cell Type"::Text);
xb.CreateBook(FileName,SheetName);
xb.WriteSheet(ReportHeader,CompanyName2,UserID2);
xb.CloseBook;
xbOpenExcel;
xb.GiveUserControl
ERROR('');
OR
xb.DELETEALL(FALSE);
xb.ClearNewRow;
xb.NewRow;
xb.AddColumn ('text1',FALSE,'',FALSE,FALSE,FALSE,'',xb."Cell Type"::Text);
xb.CreateBookAndOpenExcel(FileName,SheetName,ReportHeader,COMPANYNAME,USERID);
ERROR('');
Hi,
Try this.
This should work.
xb.DELETEALL(FALSE);
xb.NewRow;
xb.AddColumn('text1',FALSE,'',FALSE,FALSE,FALSE,'',xb."Cell Type"::Text);
xb.CreateBookAndOpenExcel('D:\S1.xlsx','Sheet1','','','');
xb.DELETEALL(FALSE);
ERROR('');
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156