A
An Dong
Hello,
under outlook 2000, i'm creating a customised form based on a task
form. i want a field to be automatically updated when an other one is
filled. and i want this field to display the due date from a
predifined number of business days. but calculating the due date in a
forumla is impossible. so i wrote a function and now i wonder how
outlook could have access to it so that i could just enter my function
and the parameters as the forumla. i hope my english is good enough
for you to understand...
if it can help, i join the function i wrote.
Thank you !
An Dong
Function GetDateDeFin(dteDebut As Date, intNbreJours As Integer) As
Date
Dim dteDateVariable As Date
Dim intNbreSem As Integer
Dim intNbreJoursRestants As Integer
Dim intJourDeLaSem As Integer
Dim i As Integer
Dim test As Boolean
Dim dteTest As Date
' nombre de semaines à ajouter d'après le nombre de jours ouvrés
en
' paramètre
intNbreSem = intNbreJours / 5
' ajout des semaines à aujourd'hui
dteDateVariable = DateAdd("w", intNbreSem, dteDebut)
' nombre de jours ouvrés restants après déduction des semaines
complètes
intNbreJoursRestants = intNbreJours
Do While intNbreJoursRestants >= 5
intNbreJoursRestants = intNbreJoursRestants - 5
Loop
'test si un des intNbreJoursRestants jours à ajouter est un samedi
i = 1
test = false
dteTest = dteDateVariable
Do While i <= intNbreJoursRestants and test = false
If Weekday(dteTest) = Saturday Then test = true
End If
i = i+1
dteTest = DateAdd("d", 1, dteTest)
Loop
'ajout du week-end si il y a un week-end
If test = true Then dteDateVariable = DateAdd("d", 2,
dteDateVariable)
' ajout des jours restants
dteDateVariable = DateAdd("d", intNbreJoursRestants,
dteDateVariable)
GetDateDeFin = dteDateVariable
End Function
under outlook 2000, i'm creating a customised form based on a task
form. i want a field to be automatically updated when an other one is
filled. and i want this field to display the due date from a
predifined number of business days. but calculating the due date in a
forumla is impossible. so i wrote a function and now i wonder how
outlook could have access to it so that i could just enter my function
and the parameters as the forumla. i hope my english is good enough
for you to understand...
if it can help, i join the function i wrote.
Thank you !
An Dong
Function GetDateDeFin(dteDebut As Date, intNbreJours As Integer) As
Date
Dim dteDateVariable As Date
Dim intNbreSem As Integer
Dim intNbreJoursRestants As Integer
Dim intJourDeLaSem As Integer
Dim i As Integer
Dim test As Boolean
Dim dteTest As Date
' nombre de semaines à ajouter d'après le nombre de jours ouvrés
en
' paramètre
intNbreSem = intNbreJours / 5
' ajout des semaines à aujourd'hui
dteDateVariable = DateAdd("w", intNbreSem, dteDebut)
' nombre de jours ouvrés restants après déduction des semaines
complètes
intNbreJoursRestants = intNbreJours
Do While intNbreJoursRestants >= 5
intNbreJoursRestants = intNbreJoursRestants - 5
Loop
'test si un des intNbreJoursRestants jours à ajouter est un samedi
i = 1
test = false
dteTest = dteDateVariable
Do While i <= intNbreJoursRestants and test = false
If Weekday(dteTest) = Saturday Then test = true
End If
i = i+1
dteTest = DateAdd("d", 1, dteTest)
Loop
'ajout du week-end si il y a un week-end
If test = true Then dteDateVariable = DateAdd("d", 2,
dteDateVariable)
' ajout des jours restants
dteDateVariable = DateAdd("d", intNbreJoursRestants,
dteDateVariable)
GetDateDeFin = dteDateVariable
End Function