Export to Excel

Hi, I’m quite new to navision. I now trying to learn how to export report into excel. Is there a code to create a new sheet in excel ? For example, i want to change to a new sheet for every 50 records in my report. And is there any tutorial about exporting to excel ? i tried to learn from table 370, report 29, 82 but there are still few things i dont understand. Thank you very much in advance. Best Regards, Jeffrey

The standard Excdel function in Navision does not have a new sheet function, but its a pretty easy mod. I have some code somewhere here, I will find it and post it in the downloads for you.

Jeffry, I can’t find the object right now, but to get you started. Basically start by copying report 29 - Export Acc. Sched. to Excel remove just about everything. The Navision excel fucniton will create one sheet in a spread sheet. So you need to first create a spread sheet for the first 50 records, save the spread sheet, then loop throught th erest creating a new tab for each next 50. Basically take this code: IF Option = Option::"Update Workbook" THEN BEGIN RequestOptionsForm.FileName.ENABLED(TRUE); RequestOptionsForm.SheetName.ENABLED(TRUE); END ELSE BEGIN FileName := ''; SheetName := ''; RequestOptionsForm.FileName.ENABLED(FALSE); RequestOptionsForm.SheetName.ENABLED(FALSE); END; and create each sheet one at a time. Alternately you could modify the Excel function in Navision to allow sheets, which would be a better solution, but only if this is somethign you will do a lot of.

Thanks, David. I already found a way to create a new sheet by adding the AddSheet function on Table 370 Excel Buffer. AddSheet() XlWrkSht := XlWrkBk.Worksheets.Add; But, is there a way to add a new sheet before or after the active sheet ? And I still dont understand about GetExcelReference. Hope you can explain it to me. Thanks.

Try looking at the Navision Manual that comes with any CD install. The developers manual C/Side comes with it to all users. Theres a good section in using Word and Excel OLE commands with C/Side and samples. You have excel create the tab’s one by one as needed. Then name them as well. Then display the Excel file to the user or just close it and tell me it’s done. Good luck.