[R] how to use Excel VBA's Shell() to call and execute R file

Guy Green guygreen at netvigator.com
Mon Apr 19 12:29:40 CEST 2010


Hi KZ,

I don't think that I can answer what I think is the precise question - how
to run the R file from VBA but without using RExcel.

However with RExcel installed, I have found it very straightforward to run R
code from within VBA (thanks Erich Neuwirth - RExcel is great).  The VBA
code is:

RInterface.StartRServer
RInterface.RunRFile "C:\Excel_R_script.txt"
RInterface.StopRServer

That is all that it takes.  "Excel_R_script.txt" is just standard R code, in
a text file.  Is there a reason you don't want to use RExcel?

Guy
-- 
View this message in context: http://n4.nabble.com/how-to-use-Excel-VBA-s-Shell-to-call-and-execute-R-file-tp2014944p2015718.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list