rrdcomclient

RDCOMClient remove auto filter


I have opened a workbook with RDCOMClient and would like to remove the auto filter on a certain sheet:

xlApp <- COMCreate("Excel.Application")
xlApp[['Visible']] <- TRUE 
xlWbk <- xlApp$Workbooks()$Open('file.xlsx')

## sheet with data filters
sheet <- xlWbk$Worksheets('Sheet1')

I've tried a couple things like:

sheet$AutoFilter()[['Value']] = FALSE

and

sheet$AutoFilter()$Filter = FALSE

But haven't been able to quite turn disable the data filter


Solution

  • This does the trick. Looked up the VBA Code and converted it. Should be useful in the future.

    sheet[["AutofilterMode"]] <- F