VBA调用DOS程序两种方法

时间:2021-03-26 13:03:43
    Set wsh = VBA.CreateObject("WScript.Shell")
'wsh.Run strExePath & " g", vbHide, True
Set wshOut = wsh.exec(strExePath & " g").StdOut While Not wshOut.AtEndOfStream
sLine = wshOut.ReadLine
Debug.Print sLine
Wend

run可以隐藏窗体

exec可以获取dos打印输出值

貌似没有即能隐藏窗体又能获取打印结果的办法。

相关文章