球差 慧差:VB的程序大家帮忙看下 叙述下就好!!谢谢了!

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/02 08:55:50
编写一个名为greatme的VBA模块,它可以位于word中,也可以位于excel中,根据系统时间弹出对话框,如果时间是0:00~12:00,则弹出“上午好”,如果时间是12:00~18:00,则弹出“下午好”,如果时间是18:00~24:00,则弹出“晚上好”。

简单用文字方式表达的,要回答做的过程,我晕啊!
谢谢大家

伪代码

sub greatme()
if hour(time)>=0 and hour(time)<12 then
msgbox "上午好!"
end if
if hour(time)>=12 and hour(time)<18 then
msgbox "下午好!"
end if
if hour(time)>=18 and hour(time)<=23 then
msgbox "晚上好!"
end if
end sub

注意等于号的应用和23时的应用。