Reputation: 21
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
Upvotes: 1
Views: 424
Reputation: 3067
There is a MacScript() function in mac VBA. The syntax looks like this:
MacScript("do shell script ""command""")
Upvotes: 1