Rafael
Rafael

Reputation: 3196

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

Upvotes: 0

Views: 134

Answers (1)

tester
tester

Reputation: 1692

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

sheet[["AutofilterMode"]] <- F

Upvotes: 1

Related Questions