[Israel.pm] Win32::OLE questions

Offer Kaye offer.kaye at gmail.com
Tue Jan 22 05:40:23 PST 2008


On Jan 21, 2008 3:38 PM, Yossi Itzkovich wrote:
>
> Now I have 2 questions:
> 1. If the filename ($mpp in this code) is not the full path, but just
> relative path, it fails

I didn't see any documentation but all the examples from:
        http://www.xav.com/perl/faq/Windows/ActivePerl-Winfaq12.html
Show a full path so I assume that yes, you need to specify the full path.

> 2. If the MSProject process was never started on that machine - the
> script fails too.

It looks (again based on the above examples) that you need to start a
new instance of an MSProject app before accessing a file using it.
Same as in the examples, e.g. copy-pasting one example:

my $Word = Win32::OLE->new('Word.Application', 'Quit');
# $Word->{'Visible'} = 1;         # if you want to see what's going on
$Word->Documents->Open("C:\\DOCUMENTS\\test.doc")
    || die("Unable to open document ", Win32::OLE->LastError());

So I guess you would replace Word here with MSProject...

Hope this helps,
-- 
Offer Kaye



More information about the Perl mailing list