mohanprasadgutta has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I am facing problem when trying to update a MS project task name cell color. here is my code.
Win32::OLE->FreeUnusedLibraries (); Win32::OLE->Initialize(Win32::OLE::COINIT_MULTITHREADED); my $app; my $project; eval{ $app = Win32::OLE->new('MSProject.Application') or print "Couldn't + open project '$MSPfilename'\n"; $app->{'DisplayAlerts'} = 0; $app->{'Visible'} = 0; $app->{'AskToUpdateLinks'} = 0; $app->OptionsGeneral(0,0,0); $app->FileOpen($MSPfilename); }; 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();
can you please let me know where i am doing wrong. thanks in advance.

Replies are listed 'Best First'.
Re: MS project Task name cell color
by moritz (Cardinal) on May 11, 2008 at 11:14 UTC
    I am facing problem

    What kind of problem? I can think of a hundred ways that a program has "a problem", from not compiling over destroying all your files up to spreading a worm over the internet.

    So what's your problem?

      Following error i am getting.
      Win32::OLE(0.1601) error 0x8002000e: "Invalid number of parameters" in METHOD/PROPERTYGET "" at msprojcq.pl line 237 i am getting error line number 237 is $Task->{Cell}->{Name}->{CellColor} = 1; (i have removed some unnecessary code from my program while posting)