Using Excel Addins with RDCOM R package


I am trying to utilize R Studio to execute VBA code within an excel template. The issue I am facing is that the VBA code leverages an custom excel add-in(XLAM file). Currently, whenever I opened an excel document, the xlam file will be opened behind the document so that excel can leverage the addin. Whenever I use COM create, R does not inherently open the XLAM file so a portion of my VBA code will not work. Is there a way for R to reference an XLAM file when using COMCreate for excel application?

Open a specific workbook in Excel:

xlApp <- COMCreate("Excel.Application")
xlWbk <- xlApp$Workbooks()$Open(Excel_One_Pathway)

this line of code might be necessary if you want to see your spreadsheet:

xlApp[['Visible']] <- TRUE

Run the macro called "MyMacro":


Close the workbook and quit the app:


Release resources:

rm(xlWbk, xlApp)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.