NAS OLE automation error

kryanker
Member Posts: 14
Hello anyone,
I had customized a function in NAV5.0 to automate an scheduled reporting email which attached with the excel file generated by the report. I was using NAV standard Excel Buffer table and a customize SaveAs functions to Save the generated excel file. Which was as following function codes and calling:
Function at Excel Buffer table:
SaveExcelFile(FileName : Text[250])
Calling at report
Report - OnPostReport()
It was running fine if I manually trigger this function.
:? But, when I set it as NAS schedule job it always return me an error as below:
This message is for C/AL programmers:
An exception was raised in method SaveAs. The OLE control or Automation server has returned error (HRESULT) -2147352567.
The component did not provide the exception description.
even I had tried to re-register the office custom control and restart the NAS, the problem is still there.
:roll:
Any idea what's the problem I facing?
Thank you.
I had customized a function in NAV5.0 to automate an scheduled reporting email which attached with the excel file generated by the report. I was using NAV standard Excel Buffer table and a customize SaveAs functions to Save the generated excel file. Which was as following function codes and calling:
Function at Excel Buffer table:
SaveExcelFile(FileName : Text[250])
IF FILE.EXISTS(FileName+'.xls') THEN IF ERASE(FileName+'.xls') THEN; XlWrkSht.SaveAs(FileName+'.xls'); XlApp.Quit;
Calling at report
Report - OnPostReport()
IF PrinttoExcel THEN BEGIN TempExcelBuffer.CreateBook; TempExcelBuffer.CreateSheet('<SheetName>','','',USERID); TempExcelBuffer.SaveExcelFile(FileName); END;
It was running fine if I manually trigger this function.
:? But, when I set it as NAS schedule job it always return me an error as below:
This message is for C/AL programmers:
An exception was raised in method SaveAs. The OLE control or Automation server has returned error (HRESULT) -2147352567.
The component did not provide the exception description.
even I had tried to re-register the office custom control and restart the NAS, the problem is still there.

:roll:
Any idea what's the problem I facing?
Thank you.
0
Comments
-
make sure the NAS user has rights to write to the directory where you are saving. Just to test it give NAS user local admin rights.0
-
:? i had already using admin as the NAS user.0
-
It's running fine also if you run the function on the NAS machine :?: Or comes there the same error?
did u try to debug the NAS? Can u save in the directory, when u loged in in Windows with the NAS account and work with excel?Do you make it right, it works too!0 -
It is running fine if I run the function manually on the NAS machine. The error I get is from the Job Queue Log Entries, it appear error on the Log status.0
-
Where is the NAS installed? Isn't it on Terminal server?0
-
The problem solved...
I use another Save function from workbook automation instead of worksheet SaveAs function, the NAS job was success. But just the excel file can not save as other format. :?IF FILE.EXISTS(FileName+'.xlsx') THEN IF ERASE(FileName+'.xlsx') THEN; XlWrkBk.SaveCopyAs(FileName+'.xlsx'); XlWrkBk.Close(FALSE); XlApp.Quit; CLEAR(XlApp);
0 -
[Topic moved from 'SQL General' forum to 'NAV/Navision' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
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