BillBarnard
(Starting to like KiXtart)
2014-04-01 02:23 PM
Unattended Automation of Office Not Supported

I recently transferred some scripts running on a virtual Windows XP machine to a virtual Windows 7 box, running Office 2010. My scripts ran daily from Task Scheduler and some opened up an Excel spreadsheet to get data. I found that running the scripts manually worked, but running with the Task Scheduler did not open Excel properly to access the data. Microsoft say they do not support the unattended automation of Office.
http://support.microsoft.com/kb/257757
The solution to get office to work via the Task Scheduler is to create a folder called Desktop in the location C:\Windows\System32\config\systemprofile
I hope this helps others with the same problem.
On another note, the ReadCSV UDF does not work if the delimiter is used inside quotes in the data.
Cheers,


Glenn BarnasAdministrator
(KiX Supporter)
2014-04-01 08:09 PM
Re: Unattended Automation of Office Not Supported

Have you tried running under specific credentials and/or enabled "Interact with Desktop"?

The CSV() UDF will properly parse CSV records. You'll need to create some code to convert a file to an array -
 Code:
$aFile = FileIO('.\file.csv', 'R')   ; read a CSV file into an array
; Convert the array of CSV strings to an array of arrays
For $P = 0 to UBound($aFile)
  $aFile[$P] = Csv($aFile[$P])
Next
This example relies on the FileIO() and Csv() UDFs, available here or in the Kix UDF Library on my web site (always the latest version).

Glenn


LonkeroAdministrator
(KiX Master Guru)
2014-04-02 12:18 PM
Re: Unattended Automation of Office Not Supported

Bill, thanks for the solution. I would most likely not run anything under system account that has to do with office but knowing that profile has to have a desktop to run automated excel is nice. do not understand why would it ever need the folder though...

I just finished a week of excel manipulation code as the website version would have been too hard to use (go figure) and it is nice to find yet another reason why the excel route is way worse. \:\)


BillBarnard
(Starting to like KiXtart)
2014-04-07 03:27 PM
Re: Unattended Automation of Office Not Supported

Thanks Glenn, I'll have a look at your UDFs.
And thanks Lonkero for the reply.
All the best,