in reply to Re^3: How to use win32::OLE with multiple versions of Microsoft Office?
in thread How to use win32::OLE with multiple versions of Microsoft Office?

I don't want to doubt what you're saying, but I am surprised that you're having issues. That line of code has worked for me on multiple systems and across multiple versions of Office (97,2003,2007,2010) on different Windows versions (XP, Vista, Win7, Win2003, Win2008) and different versions of Perl without any problems.

In fact, I just ran the code below on a Win7 box with ActiveState Perl 5.12.1 and Office 2010 installed. It ran without any errors or complaints.

use strict; use warnings; use Win32::OLE::Const "Microsoft Office .* Object Library";

I believe that I'm out of ideas/suggestions at this point. If I can think of anything, I'll come back and post it.

  • Comment on Re^4: How to use win32::OLE with multiple versions of Microsoft Office?
  • Download Code

Replies are listed 'Best First'.
Re^5: How to use win32::OLE with multiple versions of Microsoft Office?
by frida (Initiate) on Aug 08, 2011 at 17:35 UTC
    Hi Dasgar, thanks for your continuing efforts to bring clarity and monkish wisdom. I wrote this snippet:
    # print out constants loaded for Microsoft Office use strict; use warnings; use Win32::OLE::Const "Microsoft Office .* Object Library"; my $names = Win32::OLE::Const->Load("Microsoft Office .* Object Librar +y"); printf "Office type library contains %d constants:\n", scalar keys %$n +ames; foreach my $Key (sort keys %$names) { print "$Key = $names->{$Key}\n"; }
    Perl64 5.14.1 responds with:
    C:\winbat>perl -w msoconstants.pl Office type library contains 221 constants: KeepLocal = 0 LogMessages = 0 Replicable = 0 ReplicableBool = 0 V1xNullBehavior = 0 dbAppendOnly = 8 dbAttachExclusive = 65536 dbAttachSavePWD = 131072 dbAttachedODBC = 536870912 dbAttachedTable = 1073741824 dbAttachment = 101
    (more than 200 lines of similar output suppressed). Apparently there are multiple typelibs in the registry, and only by coding 14.0 do I get the mso constants.

    As far as I know, there was only one installtaion of Office 2010 on this machine, but those db constants suggest that Access (a part of Office Pro) might be involved?

      Hi guys,

      can I use Win32::OLE without installing MS Office??

      Kindly suggest me something for this.

        can I use Win32::OLE without installing MS Office??

        Sure, for other things, like controlling internet explorer (some versions of), but not for controlling MS Office, you need MS office for that

        Kindly suggest me something for this.

        I hear ice always helps :)