Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Perl-Excel Guidelines

by jsprat (Curate)
on Jul 16, 2003 at 17:16 UTC ( #274943=note: print w/replies, xml ) Need Help??

in reply to Perl-Excel Guidelines

Here at perlmonks: MSDN:
  • Excel object model (you may need to poke around for your specific version of excel, but overall it hasn't evolved much that I've seen)
On your local hard drive:
  • OLE-Browser - installed with perl, look in the ActiveState menu (if you're running ActiveState perl)
  • Open Excel, hit Alt-F11 to open VBA environment, then hit F2 to view the Object Browser
  • The Excel VB help file has the object model in detail. This helpfile is not installed by default, so you may need to rerun setup.
You'll also need curly brackets around properties, and method calls look the same as they do in straight perl:

Properties:Selection.Hidden = True $xls->Selection->{Hidden} = 1;
Methods:Worksheets(1).Activate $xls->Worksheets(1)->Activate;

A couple of things about Win32::OLE you may find helpful:

  • Win32::OLE->Option( Warn => 3 ); # or 2 or 4
  • # load all excel constants (I may have the library name wrong) use Win32::OLE::Const 'Microsoft Excel';
  • # make it a little easier to iterate over collections use Win32::OLE qw/IN WITH/;

Update: Closed the list tag, added missing tr.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://274943]
and the monks are chillaxin'...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2017-06-23 12:38 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (545 votes). Check out past polls.