AutoFilter object on spreadsheet

Y

yobofunk

Hi - new to the postgroup but I've been developing with OWC in VB .Net
for the past few months.

I'm trying to set the autofilter on the spreadsheet object but the
behavior is odd - below is my code snippet

------------------
private sub applyFilter()
Dim filt As Microsoft.Office.Interop.OWC.AutoFilter =
sprSecurityXL.Sheets(DATA_SHEET).AutoFilter()

filt.Filters(3).Criteria.FilterFunction =
Microsoft.Office.Interop.OWC.SheetFilterFunction.ssFilterFunctionExclude
filt.Filters(3).Criteria.Add("Large")

filt.Apply()
end sub
------------------
When I run the code, i can see that the arrow on the autofilter is
highlighted (turns slighlty blue), however, none of my records in my
sheet have been filtered. When I open the filter, the checkbox for
Large is deselected but it seems that the Apply method has never been
called.

Now what makes everything even more odd, is that after I call
applyFilter, I pressed OK in the autofilter menu and the filter was
applied. Later, when I call applyFilter, the apply method works!

Is this a known bug, has any encountered this, is there something I'm
forgetting to set?

Thanks
Ed
 
H

Heather

HI,

First of all, make sure the sheet is active before you do anything -

e.g.
sheetnamehere.Activate

Also, make sure that protection is not in play.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top