Washizu has asked for the wisdom of the Perl Monks concerning the following question:
The Problem:
The script crashes whenever I call the FilePageSetupHeader method on an MS Project OLE object.
The Code:
(simplified down to just show the error)
use strict; use Win32::OLE; use Win32::OLE::Variant; my $file = "C:\\blah\\test.mpp"; print "Opening " . "$file \n"; my $app = Win32::OLE->GetObject($file) or die "Couldn't open project" . Win32::OLE->LastError(); $app->{visible} = 1; $app->FilePageSetupHeader({ Name => 'Name', Text => 'test project', Alignment => '1' });
Other Info:
I'm able to open MS Project files, read/write the data, and resave them without any problem. I used Microsoft's oleviewer.exe to find the method names and here is the MSDN page for this method.
References:
I've used the following information to get me this far:
Microsoft Project and Perl Node
Activestate's OLE with Perl page.
Perl.com's Automating Windows Applications with OLE article.
Does anyone have a solution to this problem? Can anyone at least verify it? I'm running Windows XP with SP2.
Thanks in advance.
-----------------------------------
Washizu
Odd Man In: Guns and Game Theory
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MS Project, OLE, and the FilePageSetupHeader method
by VSarkiss (Monsignor) on Nov 23, 2005 at 21:09 UTC | |
by Washizu (Scribe) on Nov 23, 2005 at 21:27 UTC |