VB这段代码怎样改成按钮?

来源:百度知道 编辑:UC知道 时间:2024/07/06 14:03:02
set wso=wscript.createobject("Wscript.Shell")
b=Chr(32)
t=inputbox("输入预定关机时间,以分为单位;如值为空,则为取消自动关机")
if t="" then
wso.run("shutdown "&b&" -a")
else
t=t*60
end if
wso.run("shutdown "&b&" -s "&b&" -t "&b&" "&t&"")
wscript.quit
将以上代码写成按钮该怎样写?
dl_会飞的青蛙 你的代码有问题。

'画面添加command1

private sub command1_click()

set wso=wscript.createobject("Wscript.Shell")
b=Chr(32)
t=inputbox("输入预定关机时间,以分为单位;如值为空,则为取消自动关机")
if t="" then
wso.run("shutdown "&b&" -a")
else
t=t*60
end if
wso.run("shutdown "&b&" -s "&b&" -t "&b&" "&t&"")
wscript.quit

end sub

不需要改,直接变按钮