title: Running R from Excel VBA without RExcel
body: <p>Can this process be simplified?</p>
  
  <p><strong>First, I manually open this file in R:</strong>
  C:\R\ExampleModel\ModelScript.R</p>
  
  <p><strong>From R-Editor, when the code below is run from the open ModelScript.R file, it processes the Model.R script correctly.</strong> </p>
  
  <pre><code>source("C:\\R\\ExampleModel\\Model.R", echo=T)
  </code></pre>
  
  <p><em>Within Excel, I want to run the source code above without manually opening ModelScript.R from R first. Is there anything I can modify in the VBA code below to process the source() command automatically from Excel/VBA? If a batch process is the only option, short of Rexcel, please use the example extensions provided.</em></p>
  
  <p><strong><em>Excel 2007 VBA code:</em></strong></p>
  
  <pre><code>Sub RRUN()
  
      Dim rCommand As String
      rCommand = "C:\\Program Files\\R\\R-3.0.0\\bin\\Rscript.exe --verbose C:\\R\\ExampleModel\\ModelScript.R"
  
      'Timer Set to run full Model.R script
      Application.Wait Now + TimeValue("00:00:05")
  
      'Runs R Script and Arguements into process
      Shell rCommand, vbNormalFocus
  
      'Timer Set to run full Model.R Script
      Application.Wait Now + TimeValue("00:00:05")
  
  End Sub
  </code></pre>
  
  <p>Note: I tried using R.exe in place of Rscript.exe above, with no results. </p>