At the web site https://docstore.mik.ua/orelly/perl4/perlnut/ch23_05.htm there is a description of Win32::OLE::Const.
The 2nd paragraph is
You can either import the constants directly into your namespace as subs that return the constant value, or you can have them returned as a hash reference with the constant name as the key and its value as the value. Here's an example of the former:
use Win32::OLE::Const ("Microsoft Excel");
print "xlExcel5 = ", xlExcel5, "\n";
This produces something like:
xlExcel5 = 39
I had been using this successfully for some time. However, in October 2012 I started getting No type library matching error messages for the 1st Win32::OLE line above.
I asked the Perl Monks about this and got a number of replies.
One of these was to have the line
use Win32::OLE::Const "Microsoft Excel .* Object Library";
This worked but now has started to fail with the No type library matching error message
Another suggestion in 2012 was to have the following
use Win32::OLE;
use Win32::OLE::Const;
my $Excel = Win32::OLE->new('Excel.Application', 'Quit');
my $xlcon = Win32::OLE::Const->Load($Excel);
foreach $key (sort {$a cmp $b} keys %$xlcon) {
print "$key value $xlcon->{$key}\n";
}
This works, which is good.
However, I wondered if any Monk knew:
1. Why the row suddenly started giving these errors – as far as I can tell no changes have been made to the system;
2. Why the same version of Perl is continuing to work without any issues on another system;
3. How I could prevent the errors – (I appreciate that I probably can use the working Perl however I do not want to do that only to find that this suddenly stops working).
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.