Hey there, forgive me if this is out of the scope of these forums, but it's a real stumper.
I have a script which, for the sake of simplicity, just opens an Excel document. The script is as follows:
#!/usr/bin/perl -w use diagnostics; use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; my $file = shift(@ARGV); my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32: +:OLE->new('Excel.Application', 'Quit'); my $Book = $Excel->Workbooks->Open($file);
It runs successfully and instantaneously from the command prompt for any Excel document which I pass in. Now, I need to call this script from SQL Server using xp_cmdshell. When called in this way, it runs for about a minute, and the following error is generated:
Win32::OLE(0.1502) error 0x800a03ec in METHOD/PROPERTYGET "Open" +at c:\perl\excel\TestRead.pl line 10
Line 10 is "my $Book = $Excel->Workbooks->Open($file);".
SQL Server and Perl are running on the same machine, which is running Windows Server 2003. xp_cmdshell runs under a user called 'MegaWorker' which has execute permissions on Excel.exe, and full control on the directory with the excel file.
Any ideas? My brain hurts.

In reply to Problems opening an Excel file... by mrdowns

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.