(Solved) – Can’t run R script through Excel VBA on Macbook


I am using a MacBook pro and recently saw a question answered here on running R scripts through VBA. I tried running it with my own path and it is failing on the third line where it tries to create the shell object. Is this a security “feature” on the Macbook or is something else to blame?

Sub RunRScript3()
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

path2 = "Users/kieroneil/Documents/Analytics Projects/test.R"
errorCode = shell.Run(path2, style, waitTillComplete)

End Sub

Error Message

Leave a Reply

Your email address will not be published. Required fields are marked *