http://www.perlmonks.org?node_id=1047701

BramVanOosterhout has asked for the wisdom of the Perl Monks concerning the following question:

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

Replies are listed 'Best First'.
Re: install cpan Win32::OLE on cygwin - $Excel->Workbooks->Add; fails
by ww (Archbishop) on Aug 03, 2013 at 13:19 UTC
    Semi-OT: you said (with markup corrected):

    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.

    The "hence and the "refused" in the first statement are not factual: the anonymous submission is present (as install cpan Win32::OLE on cygwin - t/3_ole.t ....... 1/58 OLE exception from "Microsoft Excel": ) and was, in fact, front paged (added to The Monastery Gates).

    The second remark -- at best -- might reflect a misunderstanding of the status of anonymously posted nodes: No, you can't add to that node, but you could reply to it or to its replies. I hope you'll find this clarification helpful.

      My apologies. The full story is here