I am able to execute R in batch mode via Excel VBA with the code below, but this method limits interactivity because R closes after completion of the script. I would like to be able to make further calls to R based on Excel user input, while utilizing the R objects created in the first call. Is there a way to keep R active while still utilizing VBA to send messages to R?
Sub Run_R()
Dim shell As Object, Rcmd As String, retval As Variant
Set shell = VBA.CreateObject("WScript.Shell")
Rcmd = "Rscript C:\test.R"
retval = shell.Run(Rcmd, 0, True)
End Sub