Lauri Nikkinen wrote:
Thanks again. That did not work either. I get

library(RDCOMClient)
xl <- COMCreate("Excel.Application")
wk  <- xl$Workbooks()
sh <- wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count()

wk$Close()
[1] TRUE
xl$Quit()
NULL

and there is still Excel process open in the Task manager (and
sample_file.xls won't open).

-L

In my experience, the Excel process will not go away if any
Excel-related object has been created but not destroyed.  I suggest that
you explictly remove all Excel objects with rm() and run gc() at the end
to clean up:

  library(RDCOMClient)
  xl <- COMCreate("Excel.Application")
  wk <- xl$Workbooks()
  sh<-wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count()
  wk$Close()
  xl$Quit()
  rm(sh)
  rm(wk)
  rm(xl)
  gc()



J. R. M. Hosking

______________________________________________
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