title: Running R script in Excel using Shell command in VBA
body: <p>I am using some code I took from here; <a href="https://stackoverflow.com/questions/40349796/run-r-function-in-vba-macro">Run R function in VBA macro</a></p>
  
    
  
  <pre class="lang-vb prettyprint-override"><code>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 
  </code></pre>
  
  <p>I'm also using the same code itself but getting the error: Run-time error 429 mentioning "<strong>ActiveX component can't create object</strong>". 
  Please help me with this issue.
  Thank You!</p>