SRAutomater Posted October 8, 2008 Posted October 8, 2008 I am having trouble enabling AutoFilter in Excel. The VB macro looks like: Sheets("Sheet1").Select Range("A1").Select Selection.AutoFilter I am trying: $oExcel.activesheet.Range("A1").select $oExcel.selection.autofilter I get a COM error though 'Unable to get the AutoFilter property of the Range class" (number 80020009) Any help is appreciated. Thanks
DaRam Posted October 8, 2008 Posted October 8, 2008 (edited) Can you verify that Cell A1 is NOT empty? You cannot autofilter an empty (list) range. Try this: $oExcel.ActiveSheet.Range("A1").Autofilter I am having trouble enabling AutoFilter in Excel. The VB macro looks like: Sheets("Sheet1").Select Range("A1").Select Selection.AutoFilter I am trying: $oExcel.activesheet.Range("A1").select $oExcel.selection.autofilter I get a COM error though 'Unable to get the AutoFilter property of the Range class" (number 80020009) Any help is appreciated. Thanks Edited October 8, 2008 by DaRam
erik7426 Posted October 8, 2008 Posted October 8, 2008 I am having trouble enabling AutoFilter in Excel. The VB macro looks like: Sheets("Sheet1").Select Range("A1").Select Selection.AutoFilter I am trying: $oExcel.activesheet.Range("A1").select $oExcel.selection.autofilter I get a COM error though 'Unable to get the AutoFilter property of the Range class" (number 80020009) Any help is appreciated. Thanks This works for me... $myExcel = ObjCreate("Excel.Application") With $myExcel .Visible = True .WorkBooks.Open("C:\temp.xls") EndWith $myExcel.Cells(1,1).Select $myExcel.Selection.Autofilter
SRAutomater Posted October 17, 2008 Author Posted October 17, 2008 Both of these solutions worked. Thank you Erik and DaRam!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now