dana81 has asked for the wisdom of the Perl Monks concerning the following question:
Note: In the following code snippet, &w_die is a routine to write the error message to a log file before dying.
This code runs fine if I am actually logged in. However, when I try to set it up in Windows (Control Panel -> Scheduled Tasks) to read from an Excel file each day at a given time when I am not logged in, it fails.
(I AM able to read from an Oracle database this way using Scheduled Tasks when I am not logged in, with
However, trying to do the same thing with Excel when not logged in fails.)use Win32::ODBC;
Here is the snippet:
End of snippet.... use OLE; # will read Excel workbooks ... eval {$excel = Win32::OLE->GetActiveObject('Excel.Application')}; &w_die("Excel not installed") if $@; ... $excel = Win32::OLE->new('Excel.Application', sub {$_[0]->Quit;}) or &w_die("Sorry, cannot start Excel\n"); ...
The result in my logfile is:
Sorry, cannot start Excel
Again, this works fine if I am actually logged in. How can I get Perl to read from an Excel file at a given time when I am not logged in?
Thank you
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: When not logged in, using Win32::OLE for Excel fails
by Corion (Patriarch) on Jan 04, 2010 at 16:15 UTC | |
by gdolph (Novice) on Mar 31, 2010 at 09:59 UTC |