Dynamics NAV NAS/Job Queue - Excel SaveAs method failed
Yesterday I came across a really strange issue with one of our clients.
An automated routine is generating reports in Excel format and sends those out via email. The job queue entry is now reporting an error when executing the job.
“This message is for C/AL programmers: The call to member SaveAs failed. Microsoft Excel returned the following message: SaveAs method of Workbook class failed”
They migrated to new server environment and the Dynamics NAV Application Server (NAS) is now running on a Windows Server 2008 R2 (x64). One of the job queue entries that are executed via the NAS is creating Excel files that will be sent as an Email attachment. The Excel version is Excel 2013.
The generation of the Excel file is based on the Excel Buffer in NAV. To use it as an automation without user interaction a function was added to the Excel Buffer table to assist. This is also the place where the last interaction with Excel happens before the error is generated.
CloseBook(WorkBookPath : Text)
IF NOT EXISTS(WorkBookPath) THEN BEGIN
Before the migration the job was running fine. Even executing the job manually is working as expected on the new server. The problem occurs only if the NAS comes into play and executes the Job Queue entry.
This Issue is not related to permissions on the server or in NAV itself. I compared the details with the user I was using for routine the job manually and tested it out.
After a while of research I came across a change in the folder structure of windows server operating system. It seems that Excel is looking for specific folder when it is executed without a User Interface.
The folder name is simply ‘Desktop’.
For 64 bit environments the folder path is:
For 32 bit it is:
Creating this empty folder prevents NAS/Excel from generating the error.
- Downsizing Dangers - 28th October 2013
- Dynamics NAV NAS/Job Queue - Excel SaveAs method failed - 18th October 2013
- New in XLCubed 7.5 - 16th October 2013
- How to suspend and resume SQL database mirroring - 15th October 2013
- XLCubed: Excel Dashboards - 11th October 2013
- Analytical Applications of Business Intelligence Reporting - 10th October 2013
- What is Microcharts? How can it clarify data? - 10th October 2013
- Can’t print from XLCubed Web Edition - 2nd October 2013
- A call to SSPI failed in NAV 2009 R2 - 31st May 2011
- Can’t send BizTalk documents from NAV2009 Role Tailored Client - 23rd May 2011
- Unique External Document No. on Sales Order - 23rd May 2011
- CRM 2011 – NAV 2009 R2 Synchronisation – tips and tricks - 10th May 2011
- Manually Create NAV Service Instances - 3rd May 2011
- SQL Maintenance plan won't run, modify or delete - 24th November 2010
- Miscellaneous NAV RTC Development Tips - 21st November 2010
- NAV RTC Development training tools - 18th November 2010
- Microsoft Dynamics NAV Application Objects - 15th November 2010
- Delete a rogue Conur Expense Report - 12th November 2010
- CRM - 9th November 2010
- application objects
- Business Intelligence
- cached password
- Commerce Gateway
- CRM 2011
- CRM 2013
- Crystal Reports
- Data Type
- date and time
- Dynamics NAV
- Excel Buffer
- External Document No.
- Generate xsd from SQL table
- Job Queue
- Microsoft Excel
- NAV 2009
- NAV 2009 R2
- NAV Application Server
- NAV Development
- NAV Upgrade
- new version
- no delimiter
- service broker
- User Setup
- Web Service