MS Project task name cell color

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mohanprasadgutta
    New Member
    • Dec 2007
    • 33

    MS Project task name cell color

    Hello,
    I am facing problem when trying to update a MS project task name cell color. here is my code.
    [CODE=perl]
    Win32::OLE->FreeUnusedLibr aries ();
    Win32::OLE->Initialize(Win 32::OLE::COINIT _MULTITHREADED) ;
    my $app;
    my $project;
    eval{
    $app = Win32::OLE->new('MSProject .Application') or print "Couldn't
    + open project '$MSPfilename'\ n";
    $app->{'DisplayAlert s'} = 0;
    $app->{'Visible'} = 0;
    $app->{'AskToUpdateL inks'} = 0;
    $app->OptionsGeneral (0,0,0);
    $app->FileOpen($MSPf ilename);
    };

    if ($@)
    {
    my $msg = "A problem was encountered when accessing thefile '$MSPf
    +ilename'\n" . Win32::OLE->LastError()."\ n";
    print "$msg\n";
    }
    $project = $app->{Projects}->Item(1);

    if($app)
    {
    if (($project) && $project->Tasks)
    {
    my $count = $project->Tasks->Count();
    for my $indx (1..$project->Tasks->Count())
    {
    my $Task = $project->Tasks($indx) ;
    $Task->{Cell}->{Name}->{CellColor} = 1;
    }
    }#End of if appTasks loop.
    $project->Save();
    }#End of if app loop.
    $app->Quit();
    [/CODE]

    Win32::OLE(0.16 01) error 0x8002000e: "Invalid number of parameters"
    in METHOD/PROPERTYGET "" at msprojcq.pl line 237
    i am getting error
    line number 237 is my $obj = $project->Tasks->SelectRow({R ow => $indx, Column
    + => "Name"});
    (i have removed some unnecessary code from my program while posting)
    can you please let me know where i am doing wrong.
    thanks in advance.
Working...