如何在工作簿的生命周期中保持shell窗口打开

时间:2014-10-03 17:08:50

标签: r excel vba shell excel-vba

我可以通过

从VBA调用R中的脚本
Sub CallRScript()
    Dim myShell As Object
    Set myShell = VBA.CreateObject("WScript.Shell")

    Dim waitTillComplete As Boolean, style As Integer, path As String
    waitTillComplete = True
    style = 1
    path = "RScript C:\R_code\Scripts\ValuationFns.R"

    Call myShell.Run(path, style, waitTillComplete)
End Sub

但是,一旦R脚本完成运行,R会话就会关闭。我希望R会话在excel工作簿关闭之前保持打开状态,并且能够在命令提示符下运行后续命令。我怎么能做到这一点?

0 个答案:

没有答案