VBA内置函数获取当前系统时间,代码如下:
Sub NowTime() MsgBox "现在的时间是:" & Time() End Sub
也可以用If...Then来进行时间判断:
Sub IfTest_1() If Time >= 0.5 Then MsgBox "下午好!" End Sub