Two questions about opening Excel workbooks.

The operating system in Windows XP with Perl 5.8.8.
The following Perl code tries to open a spreadsheet and if successful opens a workbook.
$excel = Win32::OLE->new('Excel.Application', 'Quit') or ($excel_res = + 0, $ew_message = "Could not create excel bject"); print "[open_spreadsheet] after excel result <$excel_res> mess <$ew_me +ssage>\n"; if($excel_res == 1) { $workbook = $excel->Workbooks->Open($hist_file) or ($workbook_res + = 0, $ew_message = "Could not open excel workbook for <$hist_file>") +; print "[open_spreadsheet] after workbook result <$workbook_res> me +ss <$ew_message> for <$hist_file>\n"; }
I have a case where the workbook opening fails although the excel object worked.
To confuse matters this works on my system but not on another one.
I have been told that the spreadsheet was not open in another application such as Excel.
Can any one tell me how to find out what I wrong?
Are there any error codes available that may help?
I am reasonbly certain that the file is there but I will be checking more thoroughly.

On a more general point is there any way I can find out if a spreadsheet is open because it is being used by Excel?
The stat function gives a lot of data but not this bit.

In reply to Excel opening problems by merrymonk

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.