Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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:

Hi

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";

Comment on Linking tasks in MS Project in Perl
Download Code
Re: Linking tasks in MS Project in Perl
by Anonymous Monk on Jan 30, 2013 at 23:05 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1016082]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-09-21 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (167 votes), past polls