Page 1 of 1 1
Topic Options
#208773 - 2014-04-01 02:23 PM Unattended Automation of Office Not Supported
BillBarnard Offline
Starting to like KiXtart

Registered: 2007-03-14
Posts: 141
Loc: Leighton Buzzard, Bedfordshire...
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,
_________________________
Bill

Top
#208774 - 2014-04-01 08:09 PM Re: Unattended Automation of Office Not Supported [Re: BillBarnard]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
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
_________________________
Actually I am a Rocket Scientist! \:D

Top
#208775 - 2014-04-02 12:18 PM Re: Unattended Automation of Office Not Supported [Re: Glenn Barnas]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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. \:\)
_________________________
!

download KiXnet

Top
#208781 - 2014-04-07 03:27 PM Re: Unattended Automation of Office Not Supported [Re: Lonkero]
BillBarnard Offline
Starting to like KiXtart

Registered: 2007-03-14
Posts: 141
Loc: Leighton Buzzard, Bedfordshire...
Thanks Glenn, I'll have a look at your UDFs.
And thanks Lonkero for the reply.
All the best,
_________________________
Bill

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.195 seconds in which 0.173 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org