iNow = Hour(Time) If iNow < 6 Then strMsg="What are you doing here at this hour?" ElseIf iNow >=6 AND iNow <=12 Then strMsg="Good Morning." ElseIf iNow >=13 And iNow <=17 Then strMsg="Good Afternoon." Else strMsg="Good Evening." End If MsgBox strMsg & VbCrLf & "The current time is " &_ Time,vbOKOnly+vbInformation,"Welcome"