Re: [R] RCOM Package

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Fri 30 Jun 2006 - 05:17:15 EST

Go into Excel, turn on macro recording, perform whatever operations you want and look at whatever code is generated for you.

On 6/29/06, Thomas Sudler <thsudler@bluewin.ch> wrote:
> Hi list,
>
> I just installed the rcom package and tried to read/give out some values
> from/to Excel. Altogether it works great... but nevertheless I don't know
> how the syntax works or in other words: "Which command needs which
> parameters?"
>
> Is there somwhere a manual about this package with good examples? I've read
> the Package description... but there are not really good
> descriptions/examples.
>
> I know the following parameters/commands:
>
> #Connect to the active Workbook
> excel <- comGetObject("Excel.Application")
>
> #Set the active sheet
> sheet <- comGetProperty(excel,"ActiveSheet")
>
> #Set a specific sheet
> sheet <- comGetProperty(excel,"Worksheets","WorksheetXY")
>
> #Create a new Worksheet
> comInvoke(comGetProperty(excel,"Worksheets"),"Add")
>
> #Define a range in a defined sheet
> range1 <- comGetProperty(sheet,"Range","A1","A20")
>
> #Read out this range from Excel
> val1 <- as.double(comGetProperty(range1,"Value"))
>
> #Give back the results to Excel
> comSetProperty(range1,"Value",val1)
>
> Some of my questions are:
>
> - How can I rename a worksheet?
> - How can I define the name of a new worksheet?
> - How can I delete a worksheet?
> - How can I connect to a specific Workbook, if more than one is opened?
> - ...
>
> Can someone help me?
>
> Thanks,
> Thomas
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jun 30 05:22:21 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 30 Jun 2006 - 06:13:44 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.