
VBS如何打开关机选项
1个回答
2013-09-06
展开全部
Option Explicit
Dim oExcel, oBook, oModule
Dim strRegKey, strCode
Set oExcel = CreateObject("Excel.Application")
strRegKey = "HKCU\Software\Microsoft\Office\"&oExcel.Version&"\Excel\Security\AccessVBOM"
CreateObject("wscript.Shell").RegWrite strRegKey, 1, "REG_DWORD"
Set oBook = oExcel.Workbooks.Add
Set oModule = oBook.VBProject.VBComponents.Add(1)
strCode = "Private Declare Function SHShutDownDialog Lib ""shell32"" Alias ""#60"" (ByVal YourGuess As Long) As Long"
oModule.CodeModule.AddFromString strCode
oExcel.Run "SHShutDownDialog", 0
oExcel.DisplayAlerts = False
oBook.Close
oExcel.Quit XP测试成功..
Dim oExcel, oBook, oModule
Dim strRegKey, strCode
Set oExcel = CreateObject("Excel.Application")
strRegKey = "HKCU\Software\Microsoft\Office\"&oExcel.Version&"\Excel\Security\AccessVBOM"
CreateObject("wscript.Shell").RegWrite strRegKey, 1, "REG_DWORD"
Set oBook = oExcel.Workbooks.Add
Set oModule = oBook.VBProject.VBComponents.Add(1)
strCode = "Private Declare Function SHShutDownDialog Lib ""shell32"" Alias ""#60"" (ByVal YourGuess As Long) As Long"
oModule.CodeModule.AddFromString strCode
oExcel.Run "SHShutDownDialog", 0
oExcel.DisplayAlerts = False
oBook.Close
oExcel.Quit XP测试成功..
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询