EXCEL的宏运行完后,如何用内部VBA关闭电脑?
WIN2000EXCEL的宏运行完后,如何用内部VBA关闭电脑?<BR> ' 其中vFlags参数决定用户需要做的关机操作,
' dwReserved参数是作为保留而没有使用。
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long,ByVal dwReserved As Long) As Long
Const ShutDown = 1
Const ReBoot = 2
Const LogOff = 0
Dim Sh As Long
' 关闭计算机选项
Sh = ExitWindowsEx(ShutDown, dwReserved)
' 重新启动计算机选项
Sh = ExitWindowsEx(ReBoot, dwReserved)
' 关闭所有程序并以其他用户身份登录选项
Sh = ExitWindowsEx(LogOff, dwReserved) 在EXCEL中
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long<BR> Const ShutDown = 1<BR> Const ReBoot = 2<BR> Const LogOff = 0<BR> Dim Sh As Long<BR>Sub Macro1()<BR> Sh = ExitWindowsEx(ShutDown, dwReserved)<BR>End Sub
没响应。
页:
[1]