Saves a report as a Microsoft Office Excel file.
[Ok :=] Report.SAVEASEXCEL(Number, FileName[, Record])
[Ok :=] Report.SAVEASEXCEL(FileName)
Parameters
-
Number
-
Type: Integer
The ID of the report that you want to run. You can click View, and then click C/AL Symbol Menu to select the report from a list.
If the report you specify does not exist, a run-time error occurs.
-
FileName
-
Type: Text
The path to and the name of the file that you want to save the report as.
-
Record
-
Type: Tecord
Specifies which record to use in the report. Any filters that have been applied to the record that you specify will be used.
Property Value/Return Value
Type: Boolean
If you omit this optional return value, a run-time error occurs if the record cannot be found. If you include a return value, it is assumed that you will handle any errors.
true if the report was saved; otherwise, false.
The SAVEASEXCEL function can be used on the Report type and on Report variables, like the SAVEASHTML Function (REPORT).
When SAVEASEXCEL is called, the report is generated and saved to "FileName." A Saving to Excel window is displayed, which shows the progress of the process. If you click Cancel, the report will not be generated or saved as an Excel file. Note that the Request Form will not be shown.
The return value informs you whether the report has been saved successfully. If you use this value and an error occurs, false is returned. If you do not use the return value, the occurrence of an error results in an error message such as "Out of hard disk space", "The file parameter is not open", and so on. The object is then closed.
Reference
Report Data Type