Page 1 of 1 1
Topic Options
#117157 - 2004-04-01 02:20 AM Problem Openning Excel File
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Greetings to the Board! It's been a while since I last posted - so long I did not recognize the new layout! Looks great, and good to see the 'old timers' now as moderators.

I've got what I think is a simple question for some of you. I'm trying to open an Excel worksheet with KiX and a Scheduled Task. But, I get a failure when running the open command (Error 6, invalid file handle). But, when I run script with same user id from command line it runs fine! I snagged my code from a long-time existing script that works fine, so I am thinking problem is not KiX. Any assistance would be appreciated. Code is:
Code:

$FilXls = "nobill.xls"
$DirScr = @SCRIPTDIR
$XlsCur = $DirScr + "\" + $FilXls
$oXL = CreateObject("Excel.application")
$xlOpen = $oXL.Workbooks.Open ("$XlsCur")
; (error generated on above line)


Top
#117158 - 2004-04-01 02:25 AM Re: Problem Openning Excel File
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hi Bill, great to see you back. Will ask the obvious question ... did you try it with a fully qualified hard-code path not using @MACROS ?
Top
#117159 - 2004-04-01 02:28 AM Re: Problem Openning Excel File
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Shawn - yes, full pathing and file name w/out Macro or variables.
Top
#117160 - 2004-04-01 02:40 AM Re: Problem Openning Excel File
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Taking a stab here, can't test, but since its running under the scheduler try this after your create (just wading through object properties) ...

$oXL.Interactive = 0

Might want to join me at MSDN here.




Top
#117161 - 2004-04-01 02:45 AM Re: Problem Openning Excel File
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Shawn - I will have to investigate MSDN link tomorrow, see if the interactive setting anything else there can assist. I'll update tomorrow. Bill
Top
#117162 - 2004-04-01 03:43 AM Re: Problem Openning Excel File
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
My guess is that Shawn is on the right track. Scheduled tasks typically need to run from a batch file and be interactive if you want to see anything, otherwise it is all done without a visible console.

Top
#117163 - 2004-04-01 06:23 PM Re: Problem Openning Excel File
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
NTDOC - Right, but what's bugging me is code used to open the Excel workbook is identical to (except variable names, since I copied from my) working script that runs daily from a scheduled task that does not encounter this error. Anyway, I will test further with Shawns recommendation and let you know how if goes. Bill
Top
#117164 - 2004-04-07 12:45 AM Re: Problem Openning Excel File
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Guys - oddly, appears to be a security issue of sorts. A domain admin id will generate the error when used to run the task, but the defined domain administrator id runs fine. Work around today is evident. Thanks for the help! Bill
Top
Page 1 of 1 1


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

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.099 seconds in which 0.076 seconds were spent on a total of 12 queries. Zlib compression enabled.

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