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 –