[R] R execution by VBA Macro

dhansekaran dhana.sa at gmail.com
Tue Sep 22 12:02:15 CEST 2009


Hello everyone

I am using RExcel, an add-in to use R interface within MS Excel workbook.
The add-in is freely distributed by Statconn. Pls refer
http://www.statconn.com/ 
I need help to start writing VBA Macro to invoke and execute R to read .csv
file.
This is what I made so far… But Compilation error occurs.
Public ActiveServerAtStart As Boolean

Sub Get_Value()

  MsgBox "R putting data into excel"
  Rinterface.StartRServer
  Rinterface.RRun "z<-read.csv("F:\\mycsvfile",header=TRUE)"
  Rinterface.GetArray "z", Range("Sheet1!A1")
  Rinterface.StopRServer
  
End Sub

Here “mycsvfile” is target file from which the data is needed to be
retrieved. Get_Value() is macro name for the active worksheet. I want to get
the data to the sheet1 of active work sheet.
 
Thanks in advance.


-- 
View this message in context: http://www.nabble.com/R-execution-by-VBA-Macro-tp25530659p25530659.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list