Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

MS Project task name cell color

Question posted by: mohanprasadgutta (Newbie) on May 11th, 2008 11:28 AM
Hello,
I am facing problem when trying to update a MS project task name cell color. here is my code.
Expand|Select|Wrap|Line Numbers
  1. Win32::OLE->FreeUnusedLibraries ();
  2. Win32::OLE->Initialize(Win32::OLE::COINIT_MULTITHREADED);
  3. my $app;
  4. my $project;
  5. eval{
  6.     $app = Win32::OLE->new('MSProject.Application') or print "Couldn't
  7. + open project '$MSPfilename'\n";
  8.     $app->{'DisplayAlerts'} = 0; 
  9.     $app->{'Visible'}       = 0;
  10.     $app->{'AskToUpdateLinks'} = 0;
  11.     $app->OptionsGeneral(0,0,0);    
  12.     $app->FileOpen($MSPfilename);
  13. };
  14.  
  15. if ($@)
  16. {
  17.     my $msg = "A problem was encountered when accessing thefile '$MSPf
  18. +ilename'\n" . Win32::OLE->LastError()."\n";
  19.     print "$msg\n";
  20. }
  21. $project = $app->{Projects}->Item(1);
  22.  
  23. if($app)
  24. {
  25.     if (($project) && $project->Tasks)
  26.     {
  27.         my $count = $project->Tasks->Count();
  28.         for my $indx (1..$project->Tasks->Count())
  29.         {
  30.             my $Task = $project->Tasks($indx);
  31.            $Task->{Cell}->{Name}->{CellColor} = 1;
  32.         }
  33.     }#End of if appTasks loop.
  34.     $project->Save();
  35. }#End of if app loop.
  36. $app->Quit();


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 my $obj = $project->Tasks->SelectRow({Row => $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.
Reply
Not the answer you were looking for? Post your question . . .
189,798 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top Perl Forum Contributors