I have a DXL script, to be run in batch mode, that opens Excel, creates a new file, dumps module data into it, saves the file, and closes Excel. Here are the lines of code I'm concerned about: objExcel = oleCreateAutoObject(cObjExcelApplication) oleGet(objExcel, cPropertyWorkbooks, objWorkbooks) oleMethod(objWorkbooks, cMethodAdd) When I run the script manually, everything works fine. However, when I run the task through a VM Windows Server 2012 Task Scheduler (task configured for Win7/8), I get the following error string back from the oleMethod call to add a workbook: OLE problem: Microsoft Excel cannot open or save any more documents because there is not enough available memory or disk space. • To make more memory available, close workbooks or programs you no longer need. • To free disk space, delete files you no longer need from the disk you are saving to. OLE error code: -2146827284 Trust me, there is plenty of memory, and it works when I run it manually so that can't be the real problem. I know files can be written and saved since I have other batch scripts run by the Task Scheduler that write files. Has anyone seen anything like this before? Thanks.
oaklodge - Thu Mar 05 04:23:05 EST 2015 |
Re: oleMethod(objWorkbooks, cMethodAdd) --> "cannot open or save any more documents" Perhaps a network share is involved here? E.g. some Excel template that needs to be loaded and with the task scheduler the share is not loaded? I have seen in other contexts that programs which run as services (or with Task scheduler) do not have as many access rights as with a logged in user. You might want to cross post this question to a Windows server administration forum? |
Re: oleMethod(objWorkbooks, cMethodAdd) --> "cannot open or save any more documents" Mike.Scharnow - Thu Mar 05 05:18:47 EST 2015 Perhaps a network share is involved here? E.g. some Excel template that needs to be loaded and with the task scheduler the share is not loaded? I have seen in other contexts that programs which run as services (or with Task scheduler) do not have as many access rights as with a logged in user. You might want to cross post this question to a Windows server administration forum? The code is starting a new Excel file, so no other files are being loaded from other locations. But it leads me to wonder what would happen if I loaded an Excel file in the code, if it would allow me to get the workbook handle then... I hadn't thought about the different access rights between user and task run processes though. I'll explore that. Thanks Mike!
|
Re: oleMethod(objWorkbooks, cMethodAdd) --> "cannot open or save any more documents" oaklodge - Thu Mar 05 05:26:42 EST 2015 The code is starting a new Excel file, so no other files are being loaded from other locations. But it leads me to wonder what would happen if I loaded an Excel file in the code, if it would allow me to get the workbook handle then... I hadn't thought about the different access rights between user and task run processes though. I'll explore that. Thanks Mike!
Hi, the task scheduler run as Service session? it it this the case you have a big problem because the MS-Office COM Framework needs a User session. there is no direct solution. But only the use of a different export option first use a sharepoint server second use the https://msdn.microsoft.com/de-de/library/office/bb448854.aspx open document frame work The Open XML SDK 2.5 Productivity Tool for Microsoft Office give you the different com function bye |
Re: oleMethod(objWorkbooks, cMethodAdd) --> "cannot open or save any more documents" Have you considered modifying this thing to write the data to a CSV file instead? If there is only one sheet in the document, there isn't much reason to actually interface with MS Excel, which takes longer than generating a CSV file. Once the CSV file has been generated, it is a couple of clicks to turn it into a xlsx file. Has your problem been solved yet? If you can't run excel the way you are trying to, this may be a viable alternative. |
Re: oleMethod(objWorkbooks, cMethodAdd) --> "cannot open or save any more documents" woodpryan - Wed May 06 10:55:12 EDT 2015 Have you considered modifying this thing to write the data to a CSV file instead? If there is only one sheet in the document, there isn't much reason to actually interface with MS Excel, which takes longer than generating a CSV file. Once the CSV file has been generated, it is a couple of clicks to turn it into a xlsx file. Has your problem been solved yet? If you can't run excel the way you are trying to, this may be a viable alternative. I would if I could, and normally I do write log and dump files to C/TSV. But in this case I needed to write Object Text (rich text) and so wanted to use Excel. |