Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Linking tasks in MS Project in Perl

by rowantree (Initiate)
on Jan 30, 2013 at 15:14 UTC ( #1016082=perlquestion: print w/replies, xml ) Need Help??
rowantree has asked for the wisdom of the Perl Monks concerning the following question:


I wonder if anyone out there knows how to link tasks in MS Project via Perl? I can fire up Project, create some tasks, but cannot for the life of me work out how to get them to link 1->2, 2->3 etc so that when you open the Gantt in Project it's all joined up. The code below works OK but if anyone knows how to add in the task linkage bit that would be deeply appreciated...!

I can find very little out there examplewise on this and my mind is numb trying to work this out via VBA.

Thanks for listening

use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Project'; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); print "wake up project\n"; $prj = Win32::OLE->new('MSProject.Application') or die "Oops, cannot s +tart Project: ".Win32::OLE->LastError(); $prj->{Visible} = 1; print "adding tasks\n"; $project = $prj->{Projects}->Add; $task1 = $project->{Tasks}->Add; $task1->{Name} = "Job1"; $task1->{Duration} = 100; $task2 = $project->{Tasks}->Add; $task2->{Name} = "Job2"; $task2->{Duration} = 200; $task3 = $project->{Tasks}->Add; $task3->{Name} = "Job3"; $task3->{Duration} = 300; print $project->{Tasks}->Count(), " tasks\n";

Replies are listed 'Best First'.
Re: Linking tasks in MS Project in Perl
by Anonymous Monk on Jan 30, 2013 at 23:05 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1016082]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2018-01-18 22:48 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (215 votes). Check out past polls.