开发者

Isn't VBA Shell supposed to be asynchronous?

When I call a rebol script with

call shell("rebol.exe myscript.r")

The shell doesn't return until the script 开发者_开发百科is finished. Is there a way to force VBA Shell to be asynchronous ?


If you just want to use Shell function, try another option with using API :

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
  (ByVal hWnd As Long, ByVal lpOperation As String, _
  ByVal lpFile As String, ByVal lpParameters As String, _
  ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long 

This is the full code of ShellEx function :

http://www.vbaccelerator.com/codelib/shell/shellex.htm


You'll want to pass in a second argument to make the program run in the background. Here's the documentation.

call shell("rebol.exe myscript.r", vbMinimizedNoFocus)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜