Microsoft KB Archive/138691

= PRJ4: HoursPerDay/HoursPerWeek Properties Return Wrong Values =

Article ID: 138691

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Project 4.0 Standard Edition
 * Microsoft Project 4.0 for Macintosh

-



This article was previously published under Q138691



SYMPTOMS
The Microsoft Project Visual Basic for applications HoursPerDay and HoursPerWeek properties return only integer values. These values should return real numbers. For example, if you have hours per day set to 6.5, the HoursPerDay property incorrectly returns 6.



WORKAROUND
To work around this problem, return the value of a 1 day or 1 week duration task using Visual Basic code similar to the following:

Microsoft provides examples of Visual Basic for applications procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose. 'Save contents of Project DurationX field. You can use any of the three 'duration fields such as Duration1, Duration2, and Duration3. Temp = ActiveProject.Duration1

'Enter a 1d or 1w duration into a task to calculate the true HoursPerDay 'or HoursPerWeek. For example: ActiveProject.Duration1 = "1d"

'Return the correct hours per day or week to your function. MsgBox ActiveProject.Duration1 /60

'Set the contents of the Duration field back to its original value. ActiveProject.Duration1 = Temp



STATUS
Microsoft has confirmed this to be a problem in the products listed at the beginning of this article. We are researching this problem and will post more information here in the Microsoft Knowledge Base as it becomes available.

