split the problem into 2:
1. generate an excel file from a report (search mibuso for "excel")
2. send the file as an attachment (search mibuso for "attachment" and/or "mail")
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
split the problem into 2:
1. generate an excel file from a report (search mibuso for "excel")
2. send the file as an attachment (search mibuso for "attachment" and/or "mail")
Thanks a lot.
i know both task how to do this.
The problem is how to save excel file automatically(save at defined path like create pdf file and save it automatically ) have been generated from navision report.
I have codeunits that are run from NAS, which run reports on a scheduler. In the reports which output to an Excel file, I have a global variable FromScheduler. The codeunit calls a function in the report (which I named SetOptions), which then sets FromScheduler to True.
I have another global variable in the report PathFileName. That value is set in the SetOptions function. It is passed as a parameter from the calling codeunit.
In the CreateExcelBook function, I have the following code:
ExcelBuf.CreateBook;
ExcelBuf.CreateSheet('Data','',COMPANYNAME,USERID);
IF CalledfromScheduler THEN BEGIN
ExcelBuf.SaveWorkBook(PathFileName);
END ELSE BEGIN
ExcelBuf.GiveUserControl;
ERROR('');
END;
*********
I modifed table 370 Excel Buffer to add a function SaveWorkBook, with one parameter which is the PathFileName. The code in the function is:
Comments
1. generate an excel file from a report (search mibuso for "excel")
2. send the file as an attachment (search mibuso for "attachment" and/or "mail")
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Thanks a lot.
i know both task how to do this.
The problem is how to save excel file automatically(save at defined path like create pdf file and save it automatically ) have been generated from navision report.
I have another global variable in the report PathFileName. That value is set in the SetOptions function. It is passed as a parameter from the calling codeunit.
In the CreateExcelBook function, I have the following code:
ExcelBuf.CreateBook;
ExcelBuf.CreateSheet('Data','',COMPANYNAME,USERID);
IF CalledfromScheduler THEN BEGIN
ExcelBuf.SaveWorkBook(PathFileName);
END ELSE BEGIN
ExcelBuf.GiveUserControl;
ERROR('');
END;
*********
I modifed table 370 Excel Buffer to add a function SaveWorkBook, with one parameter which is the PathFileName. The code in the function is:
XlWrkBk.SaveAs(PathFileName);
XlWrkBk.Close(FALSE);
XlApp.Quit;
CLEAR(XlApp);
**************
And Bob's your uncle!