Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I have installed Win32::OLE with cpan notest install Win32::OLE.

That worked without a hitch.

I created a powershell script (try.ps1) that uses the add method:

$excel = new-object -comobject Excel.Application $excel.visible = $true $workbook = $excel.workbooks.add()
The command:
powershell -file try.ps1
displays an excel workbook with 1 worksheet when executed in the cygwin environment

So, unless powershell has security magic, scripts can do this, there is enough memory and disk space.

I created an equivalent perl script (try.pl):

#!/usr/bin/perl -w use strict; use Win32::OLE; my $ex = Win32::OLE->new('Excel.Application', \&Quit); $ex->{visible} = 1; print "S1 .. "; sleep 10; print "Done.\n"; my $book = $ex->Workbooks->Add(); print "S2 .. "; sleep 10; print "Done.\n"; exit;
The sleep statements makes what happens visible. Otherwise the script just finishes with the error message below.

The command:

perl -w try.pl
displays an empty workbook. There is no worksheet displayed.

The workbook closes when the script finishes and the following is displayed:

S1 .. Done. OLE exception from "Microsoft Excel": Microsoft Excel cannot open or save any more documents because there i +s not enough available memory or disk space. ¢Æ To make more memory available, close workbooks or programs you no l +onger need. ¢Æ To free disk space, delete files you no longer need from the disk y +ou are saving to. Win32::OLE(0.1709) error 0x800a03ec in METHOD/PROPERTYGET "Add" at try.pl line 11 S2 .. Done.
So it appears that Add has a problem in my environment.

I don't believe the message is disk space or memory related, there is heaps of both as I posted earlier in this conversation. And I would expect the poweshell script to have the same problem. But that script runs fine.

I inspected the cpan make compile output, which I noticed had many warnings. All the same but for the location:

OLE.xs:5764:39: warning: deprecated conversion from string constant to + ¡®char*¡¯ [-Wwrite-strings]
It's only a warning. Could it lead to my problem?

Suggestions welcome.


In reply to Re^2: install cpan Win32::OLE on cygwin - t/3_ole.t ....... 1/58 OLE exception from "Microsoft Excel": by Anonymous Monk
in thread install cpan Win32::OLE on cygwin - t/3_ole.t ....... 1/58 OLE exception from "Microsoft Excel": by Anonymous Monk

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2021-09-24 15:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?