Dear monks, Ohhhh, I used a http: is a hyperlink and hence the submission was refused. :-(

I started this thread as install cpan Win32::OLE on cygwin - t/3_ole.t ....... 1/58 OLE exception from "Microsoft Excel, but I can no longer add to that thread. If I offended, I did not mean to. My apologies.

I do have a final post re the issue raised. I believe there is a bug, but since many things work I am not sure. Below are my experiments and final conclusion. If I should post somewhere else, please refer me there.

Update: As explained below and elsewhere, my diagnosis above is incorrect.

Rather that flogging a dead horse in worrying about what does not work(as pursued in install cpan Win32::OLE on cygwin - t/3_ole.t ....... 1/58 OLE exception from "Microsoft Excel, ), I decided to see what did work. I used

Win32::OLE and Excel - Tips and Tricks by cacharbe (Curate) Thank you

I found that operations on an existing workbook work, including Add of a worksheet

$Sheet = $Book->Worksheets->Add({Before=>$Book->Worksheets(1)}) or die + Win32::OLE->LastError();
But that $Book = $Excel->Workbooks->Add; FAILS

It seems to me that the parameter passed with the plain Add creates havoc. The rest is fine

I have read through blib/lib/Win32/OLE.pm but I do not understand what that says.

For now I will work around this issue by copying an existing empty workbook as the start for my work and carry on from there.

If you can suggest something I can use as a parameter to Add that would fake it, I am happy to try that. I have tried:

1. Empty: gives the message that this thread started with

2. 'Name': gives the message (file not found):

OLE exception from "Microsoft Excel": 'D:\Users\vanoosterha\Documents\Name.xlsx' could not be found. Check t +he spelling of the file name, and verify that the file location is correc +t. If you are trying to open the file from your list of most recently use +d files, make sure that the file has not been renamed, moved, or deleted +. Win32::OLE(0.1709) error 0x800a03ec in METHOD/PROPERTYGET "Add" at tryExcel.pl line 43
3. '' (empty string) or undef() gives the out of memory message like 1.

I don't know what else I can sensibly try. As I said I am happy to try other things if you have suggestions.

To me it seems there is a bug in the Add to an empty workbook that manifests itself in the configuration listed at the start of this thread.

Thanks for listening and all suggestions so far. Bram van Oosterhout


In reply to install cpan Win32::OLE on cygwin - $Excel->Workbooks->Add; fails by BramVanOosterhout

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.