Create an Excel File from a Report

Hi, Everyone. Instead of letting the client to create an html file of Report 10040, how do I go by creating an excel file of the report while running it? (How do the codes look like?) Is this going to be automation for the MS Excel? (How do I declare the variables?) If this is feasible, where am I going to implement the codes on the report? Thanks in advance. [:o)]

in Navision 310 there are reports 81 and 82 Import/Export Budget from Excel. Alas, there I see no way to export any report to xls with some universal code like we do with html.

Hi, Yes you have to go for the automation for MS Excel. Here is the sample code for declaring the automation variable Name DataType Subtype Length --------------------------------------- xlApp Automation ‘Microsoft Excel 9.0 Object Library’.Application xlBook Automation ‘Microsoft Excel 9.0 Object Library’.Workbook xlSheet Automation ‘Microsoft Excel 9.0 Object Library’.Worksheet xlRange Automation ‘Microsoft Excel 9.0 Object Library’.Range If you want the complete code please let me know at the email id rkjais75@rediffmail.com

Please Add following Library file with variable xlApp Automation ‘Microsoft Excel 9.0 Object Library’ .Application xlBook Automation ‘Microsoft Excel 9.0 Object Library’.Workbook xlSheet Automation ‘Microsoft Excel 9.0 Object Library’.Worksheet xlRange Automation ‘Microsoft Excel 9.0 Object Library’.Range Write following code in Push Button CREATE(xlApp); xlBook := xlApp.Workbooks.Add(-4167); xlSheet := xlApp.ActiveSheet; xlSheet.Name := ‘Personal’; xlSheet.Range(A2).Value := ‘xxx’ xlApp.Visible := TRUE;

Do a search in this forum using Excel as a keyword. There you will find examples of the code I am using to generate Excel spreadsheets froma Navision Report. Keep in mind though that the reports are Processing Only. I know of no way to use the actual controls on the section to “print” to Excel other than the Save As HTML option.

Hi, Rakesh. Thank you for your postings. I have some questions about the codes that you posted. Where am I going to put the push button on the report? For that xlBook line, is the number in the bracket must be ‘-4167’? For xlSheet.Name, must the name be ‘Personal’, or it could be something else? Lastly, for the xlSheet.Range(A2).Value := ‘xxx’, how come the range must be A2, and the value must be ‘xxx’? After I run the report, is the output format of the report going to be the same as the one from Navision?