I wrote a procedure to create a spreadsheet using rdcomclient. It uses a
function to do the writing and runs "correctly" in isolation. It gives
errors, but it continues to completion. The error I receive is "Error:
Member not found". If I place it inside a for loop the loop fails after
the first iteration, once it reaches the error.

 

Has anyone had experience with this error? Here is the code that is
causing the problem.

 

 

library(RDCOMClient)

source("http://www.omegahat.org/RDCOMClient/examples/excelUtils3.R";)

xls <- COMCreate("Excel.Application")

xls[["Visible"]] <- TRUE

wb = xls[["Workbooks"]]$Add(1)

 

sh = wb[["Worksheets"]]$Add()

sh[["Name"]] <- as.character(tabName)

 

 

 

AnalyzeExport <- function(sh,Data,Cell,Title1,Title2) {

 
letters<-c("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","
P","Q","R","S","T","U","V","W","X","Y","Z")

    print(Cell)

    exportDataFrame(Data, at = sh$Range(Cell))

 

    B3R<-sh$Range(Cell)

    B3R[["Formula"]] <- Title1

    #B3R[["HorizontalAlignment"]]<-"xlRight"

 

 
B3R<-sh$Range(paste(letters[grep(substring(Cell,1,1),letters)+1],substri
ng(Cell,2),sep=""))

    B3R[["Formula"]] <- Title2

    #B3R[["HorizontalAlignment"]]<-"xlLeft"

 

    B3R<-sh$Range(paste(substring(Cell,1,1),
as.integer(substring(Cell,2))+1+nrow(Data),sep=""))

    B3R[["Formula"]] <- "Total"

 

    B3R<-sh$Range(paste(letters[grep(substring(Cell,1,1),letters)+1],
as.integer(substring(Cell,2))+1+nrow(Data),sep=""))

    Cell1<-paste(letters[grep(substring(Cell,1,1),letters)],
as.integer(substring(Cell,2))+1,sep="")

    Cell2<-paste(letters[grep(substring(Cell,1,1),letters)+1],
as.integer(substring(Cell,2))+nrow(Data),sep="")

    MyCell=paste(Cell1,":",Cell2,sep="")

    B3R[["Formula"]] <- paste("=sum(",MyCell,")",sep="")

 

    print(MyCell)

 

    B3RB <- sh$Range(MyCell)

    B3RB[["Borders"]][["LineStyle"]]<-as.integer(1)

    #B3RB[["ColumnWidth"]]<-20

}

  

 

AnalyzeExport(sh,ExcelCopy,"B2","NDC","Unique Pats")

 

The line that is causing the problem is :

B3RB[["Borders"]][["LineStyle"]]<-as.integer(1)

 

On another note, I'd also love to learn how to change columnWidth and
HorizontalAligment properly (the code commented out).

 

Jason Baucom

Ateb, Inc. 

2600 Sumner Blvd. Suite 158

Raleigh, NC 27616

www.ateb.com <http://www.ateb.com/> 


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to