how to save excel file for attachment
vijay_g
Member Posts: 884
hi,
i need to save excel file that has generate by navision report so that i could attach it for sending mail.
i need to save excel file that has generate by navision report so that i could attach it for sending mail.
0
Comments
-
Belias wrote: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.0 -
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:
XlWrkBk.SaveAs(PathFileName);
XlWrkBk.Close(FALSE);
XlApp.Quit;
CLEAR(XlApp);
**************
And Bob's your uncle!0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions