0
我正在使用一些代码, Run R function in VBA macro在VBA中使用Shell命令在Excel中运行R脚本
Sub RunRscript()
'runs an external R code through Shell
'The location of the RScript is 'C:/Users/abhishek.b.jai/Downloads/data'
'The script name is 'testcode.R'
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/abhishek.b.jai/Downloads/data/testcode.r"
errorCode = shell.Run(path, style, waitTillComplete)
End Sub
我还使用相同的代码本身,但得到的错误:运行时错误429提“ActiveX组件不能创建对象”。 请帮我解决这个问题。 谢谢!
你在Mac上运行吗? –
检查您的参考? – Lowpar
检查此答案:https://stackoverflow.com/questions/18306362/run-r-script-from-command-line –