[R] R-Excel Macro Problem

nmarti nate318i at yahoo.com
Sun May 25 18:39:49 CEST 2008


Yasir, I couldn't find your email address, I'm new to the forum.  Here's the
code,

Sub Run_ModelT()

    Call Rinterface.StartRServer
    Call Rinterface.PutDataframe("DataSet", Range("Peram!A1:E2000"))
    Call Rinterface.RRun("attach(DataSett)")
    Call Rinterface.RRun("model <- lm(Ch_Close_1 ~ Ch_Gold_1)")
    Call Rinterface.GetArray("coeftest(model)", Range("OutPut!D7"))
    Call Rinterface.GetArray("summary(lm(model))$r.squared",
Range("OutPut!G3"))
    Call Rinterface.GetArray("summary(lm(model))$adj.r.squared",
Range("OutPut!G4"))

End Sub

I'm still looking for the problem.  I'm beginning to think it dosen't have
anything to do with code.  I think there's a problem with the com server or
something else.
Thanks for the help.



Yasir Kaheil wrote:
> 
> hi Nate,
> could you please email me your excel workbook. thanks
> y
> 
> nmarti wrote:
>> 
>> I'm trying to write R functions into VBA code.  I've done this many other
>> times in other documents and everything has run great.  But today I keep
>> recieving an error message "Run-time error '1004': Application-defined or
>> object-defined error."
>> 
>> Has anyone else encountered this same error message?
>> 
>> I do not recieve this error in the document when running regular VBA
>> code.  But when I try to run,
>> Call Rinterface.PutDataframe("Data", Range("Sheet1!A1:E2000"))
>> I receive the error.
>> I have the VBA "References" RExcelVBAlib checked.
>> 
>> Any suggestions would be appreiciated,
>> Nate
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/R-Excel-Macro-Problem-tp17450757p17459745.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list