0

I am working on a project using excel VBA as a user interface to R. In the VBA code I call the R script using the shell.run method. It opens the command prompt and runs r through that. The r code performs functions and at the end writes data to an excel file and saves it in my documents. If there are any errors, I want it to stop before the VBA code continues. We have implemented error handling in the r script with booleans. Is there a way for R to return these variables to VBA? Any other thoughts on how to get the error handling messages from R to VBA before the rest of the code continues would be appreciated. Thank you.

Community
  • 1
  • 1
cincy637
  • 11
  • 1
  • You could use one of the R packages that lets you create excel files, create one, and use your VBA to import it when it gets a signal from R that the file writing is done. Probably. – Hack-R Jul 07 '16 at 17:28
  • Thank you for your response. We thought of that but were hoping to avoid creating another file as that seems a little bit clunky. Was hoping for a more streamlined method. – cincy637 Jul 07 '16 at 17:29
  • http://stackoverflow.com/questions/2784367/capture-output-value-from-a-shell-command-in-vba – Tim Williams Jul 07 '16 at 17:34

0 Answers0