标题: [问题求助] vbs 调用excel api [打印本页]
作者: czjt1234 时间: 2018-4-29 15:42 标题: vbs 调用excel api
- Option Explicit
- Dim oWS, oFSO, oExcel, s
-
- Set oWS = CreateObject("WScript.Shell")
- Set oFSO = CreateObject("Scripting.FileSystemObject")
- Set oExcel = CreateObject("Excel.Application")
- oExcel.DisplayAlerts = False
-
- s = "HKEY_CURRENT_USER\Software\Microsoft\Office\$\Excel\Security\AccessVBOM"
- oWS.RegWrite Replace(s, "$", oExcel.Version), 1, "REG_DWORD"
-
- s = "Private Declare Function FindWindow Lib ""user32"" Alias ""FindWindowA"" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long"
-
- oExcel.Workbooks.Add.VBProject.VBComponents.Add(1).CodeModule.AddFromString s
-
- oWS.Run "%windir%\system32\calc.exe"
- MsgBox "下面查找新打开的标题栏:计算器", vbSystemModal
-
- s = oExcel.Run("FindWindow", vbNullString, "计算器")
- MsgBox "窗口句柄: " & s
-
- oExcel.Quit()
复制代码
这个怎么一直找不到窗口的
作者: czjt1234 时间: 2018-4-30 13:38
用dynwrap.dll这个可以的
估计是vbs把vbNullString转换为""后传递参数了
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |