Hi
I am trying to create, populate and the save an excel file through the use of automation only. This is to happen without excel being visible to the user.
Navision is UK 4.00 sp3
Excel is from office 2003
Automation is Microsoft Excel 11.0 Object Library
I can create an excel worksheet successfully. The code to save it causes the error
"This message is for C/AL programmers: Could not invoke the member SaveAs. The OLE control or Automation returned the following message: The requested member does not exist, or the call tried to set the value of a read-only property."
Main bits of code for this issue are :
Global Vars:
MSExcel Automation 'Microsoft Excel 11.0 Object Library'.Application
XLBook Automation 'Microsoft Excel 11.0 Object Library'.Workbook
XLSheet Automation 'Microsoft Excel 11.0 Object Library'.Worksheet
CLEAR(MSExcel);
CREATE(MSExcel);
MSExcel.Visible(FALSE);
XLBook := MSExcel.Workbooks.Add;
XLSheet := XLBook.ActiveSheet;
XLSheet.Name := 'First Sheet';
XLBook.SaveAs('C:\test.xls');
It is the last line that generates the error. I have tried replacing the final line with XLSheet.SaveAs('C:\test.xls'), but get the same error.
Any help would be greatly appreciated.
0
Answers
This is a code extract from that tool:
WorkbookPath is text [250] (which in your case would be 'C:\test.xls')
|To-Increase|
I am now beginning to suspect the my installation of office 2003.
|To-Increase|
I had the same problem with Word automation and it worked...
Thanks for the prompt replies.
I think the problem arose because I also had just excel 2000 installed (after office 2003).