TMGR: OLE Automation Error When Setting Work Values (159630)



The information in this article applies to:

  • Microsoft Team Manager

This article was previously published under Q159630

SYMPTOMS

When you try to apply Total Work or Remaining Work to a task through OLE automation, you may receive the following error message:
Run-time error '1'.

There was an OLE Automation error.

CAUSE

If the task has more than one person assigned, the Total Work or Remaining Work value you are trying to set is less than the existing value.

NOTE: If you try to do the same thing from within Microsoft Team Manager, you will receive the following error message:
The total work needs to be equal to or greater than the amount of work currently assigned, or the amount of actual work done on the task.

Either increase the total work value or decrease the amount of work assigned in the People Assigned column.

STATUS

This is by-design in Microsoft Team Manager.

MORE INFORMATION

When more than one person is assigned to a task, you need to set the work for each person on the task; the task will then reflect the correct rolled up work values for assigned work. For example, the following code fails on a task with more than 1 person assigned and Total Work of 3 days:
   Sub SetWork()

   Set Tmgr = GetObject(,"TeamManager.Application")
   Tmgr.Tasks(1).TotalWork = "1d"

   End Sub
				
In order to decrease the work on the task to 1 day with no unassigned work, you could do something similar to:
   Sub SetWork()

   Set Tmgr = GetObject(, "TeamManager.Application")
   ' Set total work on each assignment.
   For Each PeopleAssignment In Tmgr.Tasks(1).Assignments
      PeopleAssignment.TotalWork = ".5d"
   Next
  ' Remove unassigned work from task; otherwise, the task will still show
  ' 3 days of work.
  Tmgr.Tasks(1).TotalWork = "1d"
  End Sub
				

Modification Type:MinorLast Reviewed:8/17/2005
Keywords:kberrmsg KB159630