I am using Excel 2007 on a windows XP PC. Typically I just use the following at the beginning of Perl where I am reading and/or writing Excel spreadsheets.
use Win32::OLE;
use Win32::OLE qw(in with);
use Win32::OLE::Variant;
use Win32::OLE::Const 'Microsoft Excel';
In the O’Reilly Excel Macros by Steven Roman there are given a number of lists of constants which all start with
Enum property name
with the constant name and values underneath
For example, the first three for XLFileFormat are given as
xlAddIn = 18
xlCSV = 6
xlCSVMac = 22
It would be very helpful to be able to write out these lists.
‘John’ replied to an earlier request of mine with the Perl code of
use strict;
use Win32::OLE;
use Win32::OLE::Const;
my $xl = Win32::OLE::Const->Load("Microsoft Excel");
printf "Excel type library contains %d constants:\n", scalar keys %$xl
+;
foreach my $Key (sort keys %$xl) {
print "$Key = $xl->{$Key}\n";
}
This does seem to give all the values of the constants that I am looking for. However, it does not associate these with any property
Is there any way that Perl can be used to write out these lists so that I can tell with which property they can be used with?
For me it would be perfectly acceptable to have a whole of statements like
Enum(‘XLFileFormat');
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.