[python-win32] Problem with excel AutoFilter function

Sylvain FAUVEAU (apli-agipa) info at apli-agipa.com
Mon Feb 20 10:48:44 CET 2006


Hello.

I have a little problem with the function AutoFilter in Excel.

The VB code for activate, desactivate AutoFilter is the same :
AutoFilter

But if I try this in python it doesn't work !

For activate the autofilter in python, I make this :
selection.AutoFilter(Field=1)
It works.

But to desactivate the autofilter, if I try :
selection.AutoFilter() # without arguments
Python says :
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File 
"C:\usr\Python24\lib\site-packages\win32com\gen_py\00020813-0000-0000-C000-000000000046x0x1x5.py", 
line 22262, in AutoFilter
    , Criteria1, Operator, Criteria2, VisibleDropDown)
  File "C:\usr\Python24\Lib\site-packages\win32com\client\__init__.py", line 
446, in _ApplyTypes_
    return self._get_good_object_(
com_error: (-2147352567, "Une exception s'est produite.", (0, 'Microsoft 
Office Excel', 'La m\xe9thode AutoFilter de la classe Range a 
\xe9chou\xe9.', 'C:\\usr\\Microsoft Office\\OFFICE11\\1036\\xlmain11.chm', 
0, -2146827284), None)

I also try with arguments Field=None with the same result.

How can I desactivate this #?#?!#? autofilter ?

Thanks !

Sylvain FAUVEAU 



More information about the Python-win32 mailing list