Jeweller89
Jeweller89

Reputation: 19

Create new Excel application using RDCOMClient

I have the following code which uses the existing and open Excel application. How to I force R to open a new Excel application and open the workbook in this new Excel station?

xlApp <- COMCreate("Excel.Application")
xlWbk <- xlApp$Workbooks()$Open("S:/x/z/y.xlsb")
xlApp[['Visible']] <- TRUE 

Upvotes: 0

Views: 498

Answers (1)

Emmanuel Hamel
Emmanuel Hamel

Reputation: 2233

You can consider the following approach :

library(RDCOMClient)

path1 <- "D:\\test1.xlsx"
path2 <- "D:\\test2.xlsx"

xlApp1 <- COMCreate("Excel.Application")
xlWbk1 <- xlApp$Workbooks()$Open(path1)
xlApp1[['Visible']] <- TRUE 

xlApp2 <- COMCreate("Excel.Application")
xlWbk2 <- xlApp$Workbooks()$Open(path2)
xlApp2[['Visible']] <- TRUE 

Upvotes: 0

Related Questions