syntax of the DateDifference method

R

Robert

Hello,
What is the syntax of the DateDifference(StartDate, FinishDate, Calendar)
method.
Especially, how to write the calendar name : between quotes? commas,...
The following sub returns an error : incompatibility of type.
Thanks

Sub Durée()
Dim Deb As Date
Dim Fin As Date
Deb = ActiveCell.Task.Start
Fin = ActiveCell.Task.Finish
Debug.Print Application.DateDifference(Deb, Fin, "Standard") / 420
End Sub
 
R

Robert

Thanks a lot Rod,
But what will be the syntax if the calendar is *not* the
Activeproject.Calendar? In this case, I make the calculation with another
calendar which is not the project calendar.
Thanks again
 
R

Robert

Thanks Jan,
It works, excepted for the 2 build-in calendars : 24 Hours and Night Shift :
error 1101
Why ?
 
J

Jan De Messemaeker

Hi,

From the top of my head, I would say they don't exist in the activeproject
as you probably never used them
They would exist in application.basecalendars
HTH

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 
R

Robert

Hi Jan,
I still have error 1101 with Application.BaseCalendars("Night Shift")
;-(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top