By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,838 Members | 1,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,838 IT Pros & Developers. It's quick & easy.

MS Project task name cell color

P: 33
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();
  37.  
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.
May 11 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.