BramVanOosterhout has asked for the wisdom of the Perl Monks concerning the following question:
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.
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
But that $Book = $Excel->Workbooks->Add; FAILS$Sheet = $Book->Worksheets->Add({Before=>$Book->Worksheets(1)}) or die + Win32::OLE->LastError();
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):
3. '' (empty string) or undef() gives the out of memory message like 1.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
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 | |
by BramVanOosterhout (Novice) on Aug 04, 2013 at 02:35 UTC |