Excel 2007 SaveAs Method of Workbook Class Failed

klavin
Member Posts: 117
Hey everyone,
I just moved the NAS from one machine to another - installed the same version of Excel 2007. Running on Server 2008 NAV 5.0 SP1.
Before I ran updates, I tried having the NAS Fire off some of the jobs I had setup and been using for quite some time now. In them I am using Excel Buffer to make an excel file and then call my own Function in ExcelBuffer where I pass the Filename and save type.
I attempted removing this since it was optional - saving it as 2007, and even tried the SaveAsCopy method.
For some reason now, this is the part that isn't making sense to me, When I run the codeunit manually (EDIT: From this server using NAV Cleint) - it works. When the NAS Runs it, I get this in the Job Queue Log Entries:
The NAS Login has permission to everywhere it is writing - there is nothing in the Event Viewer except Microsoft Office Sessions Warning just saying:
I installed updates, still nothing. Kinda getting stumped. I searched the forums, google and maybe I'm just having a real tired moment today... I know it has to do with the NAS/Login since I can run it... unless Excel is trying to pop up something that is causing it to fail...
Anyone see anything like this? ](*,)
I just moved the NAS from one machine to another - installed the same version of Excel 2007. Running on Server 2008 NAV 5.0 SP1.
Before I ran updates, I tried having the NAS Fire off some of the jobs I had setup and been using for quite some time now. In them I am using Excel Buffer to make an excel file and then call my own Function in ExcelBuffer where I pass the Filename and save type.
XlWrkBk.SaveAs(FileName,iTypeCode); XlWrkBk.Close(); XlApp.Quit();iTypeCode = 56 for Excel 2003 file.
I attempted removing this since it was optional - saving it as 2007, and even tried the SaveAsCopy method.
For some reason now, this is the part that isn't making sense to me, When I run the codeunit manually (EDIT: From this server using NAV Cleint) - it works. When the NAS Runs it, I get this in the Job Queue Log Entries:
This message is for C/AL programmers: The call to member SaveAs failed. Microsoft Office Excel returned the following message: SaveAs method of Workbook class failed
The NAS Login has permission to everywhere it is writing - there is nothing in the Event Viewer except Microsoft Office Sessions Warning just saying:
ID: 1, Application Name: Microsoft Office Excel, Application Version: 12.0.6524.5003, Microsoft Office Version: 12.0.6425.1000. This session was terminated unexpectedly.
I installed updates, still nothing. Kinda getting stumped. I searched the forums, google and maybe I'm just having a real tired moment today... I know it has to do with the NAS/Login since I can run it... unless Excel is trying to pop up something that is causing it to fail...
Anyone see anything like this? ](*,)
-Lavin
"Profanity is the one language all programmers know best."
"Profanity is the one language all programmers know best."
0
Comments
-
1) Have you tried to run the NAS from console?
2) Have you tried to run the NAS as service under your account?0 -
Have you found solution for this? I'm experiencing the same problem.
I am logged as administrator. When I run the process manually from NAV client, everything works fine.
When it is processed on nas (under the same user) it ends with the error described in first post.0 -
Is there some dialog opened during the SaveAs when you are running it from client? I assume not, but I want to be sure...0
-
To be honest I never did resolve the issue as it was... I did end up writing a new office open xml codeunit and tables (buffer table with style id and worksheet id with cell data etc..., worksheet table holding worksheet id/name, and styles table holding the different styles). Temporarily I did end up just letting this process run under the old server and same account until I completed the office open xml stuff.
Mind you what I wrote wasn't a complete office open xml solution (if it was I would share it) it completed everything I needed and makes saving .xls files (in xml) and being able to email them SIGNIFICANTLY faster using the same methods of AddColumn etc that Excel Buffer offered. Only difference is users have to open the file opposed to it being automatically opened.-Lavin
"Profanity is the one language all programmers know best."0 -
I ran into this today when running under NAS and the following post solved this.
http://social.msdn.microsoft.com/Forums ... 421818ef91
I had to create the Desktop folder on windows 2008 64 bit server as they mentioned and it started working under NAS.0 -
Adding Desktop folder worked for me as well - after 2 days of banging my head against the wall... This is the most obscure kind of a solution I've ever come across.0
-
Hi,
Thanks for this wonderful trick. Unfortunately even after creating this desktop folder, still I am getting same error.
Actually I have two server ( in two separate country ). In one server , NAS is running under a service account and I created the desktop folder and after that it worked absolutely fine.
In other server, NAS is running under a user account ( and that user account has been granted to log on as service ) and here also I created desktop folder and assigned full access to that folder and APPDATA folder for this user account ( rather I gave everyone read/write permission ) and still getting the same error message.
Am I missing something?
Thanks in advance.
Regards,
Sayan0 -
try, try, try......
SaveWkrSpace(FileName : Text[250])
XlApp.Visible(FALSE);
//>TB20190516
//XlWrkSht.SaveAs(FileName);
//XlWrkBk.SaveAs(FileName);
XlWrkBk.SaveCopyAs(FileName);
//<TB20190516
XlWrkBk.Close(FALSE);
XlApp.Quit;
CLEAR(XlApp);0 -
I had the same problem on windows server 2012r2 x64
Although the system is 64 bit, it was necessary to add folders in both locations:
C:\Windows\SysWOW64\config\systemprofile\Desktop
C:\Windows\System32\config\systemprofile\Desktop
after that everything works fine0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions