Your question doesn't include the error message you get (why not?) but I am guessing you are getting a NameError at win32c.xlTopCount
because there is no module win32c
. Unless, of course you have some something like import win32com as win32c
in which case you will get an AttributeError.
xlTopCount
is a VBA constant, not a PythonWin constant, and in general PythonWin does not have Python analogues for such constants. You're expected to look them up. Checking the documentation for what you are trying to do will quickly show that the value of xlTopCount
is 1.
So use 1
instead of the nonexistent constant win32c.xlTopCount
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…