PRJ: DateAdd and DateDifference Methods Don't Work (171060)
The information in this article applies to:
- Microsoft Project 2000
- Microsoft Project 98 for Windows
This article was previously published under Q171060 SYMPTOMS
In Microsoft Project 98 or later, when you attempt to use a Microsoft Project version 4.0 or Microsoft Project for Windows 95, version 4.1, macro that uses the Visual Basic for Applications DateAdd or DateDifference method, it does not function correctly.
CAUSE
This behavior occurs in Microsoft Project 98 or later because the DateAdd or DateDifference methods must be fully qualified by the Application object or they will not function correctly.
WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
To work around this behavior, in Microsoft Project 98 or later, precede the DateAdd or DateDifference method with Application. For example to use the DateDifference command in Microsoft Project 98 or later, change this code
Sub Test()
MsgBox DateDifference("1/1","6/1")
End Sub
to this:
Sub Test()
MsgBox Application.DateDifference("1/1","6/1")
End Sub
Modification Type: | Major | Last Reviewed: | 6/23/2005 |
---|
Keywords: | kbmacro kbprb kbProgramming KB171060 |
---|
|