Problem solved.
The mechanism for running R files has changed.
I am using a textConncetion now.
Your R code has calls closeAllConnections
and so closes also the connection RExcel is using.
As far as I see your code is not opening connections,
so you don't have to close either.
This is probably a remainder from the original tests
when you used the read.table statements
which are now commented out.
Using a command with global side effects
like closeAllConnections is not a good idea in a complex system
like RExcel. Doing global stuff in as subroutine called by somebody else
(RExcel in out case) is something one should definitely avoid.

An additional remark.
You also have a lot of implicit print statements
when you just use variable names as commands.
This commands do not produce output in the RGui window,
and they also do not transmit information to Excel.
So it would be better to remove these commands also.


Your macros also use a lot of Select statements,
probably because you used the macro recorder.


Instead of
    Range("J2").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.ClearContents

you could also do

    Dim StartCell As Range
    Set StartCell = Range("J2")
    Range(StartCell, StartCell.End(xlDown).End(xlToRight)).ClearContents

When working with ranges in macros it is not necessary to select them.
To work with ranges interactively you have to select them.
Therefore, the macro recorder will always use Select,
but in your VBA code they are unnecessary.



Felipe Carrillo wrote:
Erich: I have attached the workbook and the R script. When
the workbook is opened it creates a new menu called
"MST Model" with a submenu "Get MST CI's". Click on
the submenu to run the "Run_RStatistics" macro. Let me
know if you have any questions. Thanks



--- Erich Neuwirth <[EMAIL PROTECTED]>
wrote:

Can you pack your files an either send them or put
them in a place where I can download so I can reproduce the error?


Felipe Carrillo wrote:
Erich: I tried and I got the same Error messages
four
times and then the message saying that the errors
were
too many to count and continued executing
correctly. I
still get the values that I want but with the
error
messages. I traced the errors to the
RServer.Module
and couldn't figure out where they are occurring.
I
wonder if there's a way to put a "On error resume
next" statement because in reality there's not
errors
as I still getting the desired results that I was
getting with the older version. I uninstalled RExcelInstaller and ran my code
with
the older version and its working nicely again.
Thanks Erich for the great job.

--- Erich Neuwirth <[EMAIL PROTECTED]>
wrote:

Please try the following addin file
Put it in C:\Program Files\RExcel\xls
but save the original version first in a safe
place
and check what happens.


--
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459


 Felipe D. Carrillo
  Fishery Biologist
  Department of the Interior
  US Fish & Wildlife Service
  California, USA



____________________________________________________________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

--
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459



 Felipe D. Carrillo
  Fishery Biologist
  Department of the Interior
  US Fish & Wildlife Service
  California, USA



      
____________________________________________________________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

--
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459
_______________________________________________
Rcom-l mailing list
Rcom-l@mailman.csd.univie.ac.at
http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
More information (including a Wiki) at http://rcom.univie.ac.at

Reply via email to