user310291 user310291 - 2 months ago 16
Bash Question

Capture output value from a shell command in VBA?

Found this function
http://www.cpearson.com/excel/ShellAndWait.aspx

But would need also to capture output from the shell output. Any code suggestion ?

Answer

You can CreateProcess the application redirecting its StdOut to a pipe, then read that pipe directly; http://pastebin.com/CszKUpNS

dim resp as string 
resp = redirect("cmd","/c dir")
resp = redirect("ipconfig","")