VBA调用DOS程序两种方法

    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打印输出值

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

posted @ 2017-05-29 22:26  马语者  阅读(2501)  评论(0)    收藏  举报