user defined fields

B

Beatrice

Hi,
does anybody know how I can draw up a user defined filed
which includes a special data form? The data form I'd like
for our project timing chart is 337.5 which is the date of
today. It means 3 for the year 2003, 37 for the current
week and .5 because it's the 5th day of the week.
If anybody knows how I can solve this task I'd be happy
hearing from you.
Thank you!
Bye, Beatrice
 
J

Juergen Stock

Beatrice,

function "DateFormatYWWdotD" below will do the job:

Sub Use_DateFormatYWWdotD() 'just for demonstation
MsgBox DateFormatYWWdotD(aDate:=Date)
End Sub

Function DateFormatYWWdotD(aDate As Date) As String

Dim y As String
Dim wk As String
Dim d As String

Const Jan1 = "01-Jan-"
Dim Jan1ThisYear As String

y = Year(aDate)

Jan1ThisYear = Jan1 & CStr(y)

y = Right(y, 1)

wk = DateDiff("ww", Jan1ThisYear, aDate, vbSunday,
vbFirstFourDays) + 1

d = Weekday(aDate, vbMonday)

DateFormatYWWdotD = y & wk & "." & d
End Function

In another sub you can make an assignment to a task t like
this:
t.text1=DateFormatYWWdotD(aDate:=t.start)

Hope that helps!

Juergen
 

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