This example gets a date in an input box and displays the day of the week and its name for the date entered.
Sub Main()
????Dim a$(7)
????a$(1) = "Sunday"
????a$(2) = "Monday"
????a$(3) = "Tuesday"
????a$(4) = "Wednesday"
????a$(5) = "Thursday"
????a$(6) = "Friday"
????a$(7) = "Saturday"
Reprompt:
????bd = InputBox("Please enter your birthday.","Enter Birthday")
????If Not(IsDate(bd)) Then Goto Reprompt
????dt = DateValue(bd)
????dw = WeekDay(dt)
????Msgbox "You were born on day " & dw & ", which was a " & a$(dw)
End Sub
|