View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
James Glover James Glover is offline
external usenet poster
 
Posts: 4
Default AutoFilter Automation from VB.NET

I have searched the groups and haven't really found the answer to my
question...

Why can I not get the AutoFilter functionality to work through VB.NET/COM
Interop automation?
Example:

'xlRange = Excel.Range object for some specific range, "2:2" for the
second row
xlRange.AutoFilter(Field:=1)

This code doesn't work. It actually causes the AutoFilter drop down boxes
to appear on the cells in the range, but the drop down buttons do not work.
I do not have multiple worksheets selected nor is the worksheet protected,
the really weird thing is this:
If I open the template file, place some dummy data in the template, turn on
Autofilter, save the template, the turn AutoFilter off and delete the data,
save the template again the above code works just fine. Why can I not use
this code on a new template, one which hasn't gone through the preceding
hoops.

I am using VB.NET, 1.1 Framework and Office 2003.

Thanks in advance, anything would be appreciated

James Glover