VB Classic Sub & function Example
If you define the following sub and funtion:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Subs and Functions
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub DoSomeCode(ByRef pMessage)
MsgBox (pMessage)
End Sub
Function GetLastDOW(ADate, AWeekDayConst)
While Weekday(ADate) <> AWeekDayConst
ADate = DateAdd("d", -1, ADate)
Wend
GetLastDOW = ADate
End Function
You can call them. For example, the following code is from the click event of a button:
Private Sub Command1_Click()
DoSomeCode ("Hello3")
MsgBox "Last Monday was " & GetLastDOW(Date, vbMonday)
End Sub