权限被拒绝-通过Shell命令从excel vba运行R脚本时出现运行时错误70

时间:2018-12-04 10:42:35

标签: r excel vba

我正在尝试通过shell命令通过excel vba运行rscript。我在运行时遇到运行时错误70。在Windows 8之前,它工作正常。使用Windows 10我正面临这个问题。这与管理员访问权限有关吗?

VBA代码:

Sub RunRscript()


Dim shell As Object
Set shell = VBA.CreateObject("WScript.Shell")
Dim waitTillComplete As Boolean: waitTillComplete = True
Dim style As Integer: style = 1
Dim errorCode As Integer
Dim path As String

path = """" & "C:\Users\Kreshnaa Raam S B\Documents\R\R-3.5.1\bin\x64\Rscript.exe" & """ """ & Sheet1.Range("C12") & """"
errorCode = shell.Run(path, style, waitTillComplete)

End Sub

错误消息: enter image description here

0 个答案:

没有答案