PRJ4: HoursPerDay/HoursPerWeek Properties Return Wrong Values

ID: Q138691

The information in this article applies to:

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.

REFERENCES

For additional information, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q132092
   TITLE     : PRJ4: Converting Duration Values

Additional query words: 4.10
Keywords          : kbcode kbprg
Version           : 4.0
Platform          : MACINTOSH WINDOWS
Issue type        : kbprb

Last Reviewed: November 25, 1997