mhammond / pywin32

Python for Windows (pywin32) Extensions
5.01k stars 793 forks source link

got a unexpected error when i use Shape.TextEffect in win32com #2078

Open mooremok opened 1 year ago

mooremok commented 1 year ago

pywin32 version 305

I use win32com to work with Microsoft documents and I want to use shape to distinguish between normal text fields and artistic text fields. When I usedoc.Shapes.Item(1).texteffect, the doc is a Document Object, the following error was returned:

Cell In[46], line 1
----> 1 doc.Shapes.Item(1).TextEffect

File [d:\myproject\sanxue_gui\env_format\lib\site-packages\win32com\client\dynamic.py:628](file:///D:/myproject/sanxue_gui/env_format/lib/site-packages/win32com/client/dynamic.py:628), in CDispatch.__getattr__(self, attr)
    624 debug_attr_print(
    625     "Getting property Id 0x%x from OLE object" % retEntry.dispid
    626 )
    627 try:
--> 628     ret = self._oleobj_.Invoke(retEntry.dispid, 0, invoke_type, 1)
    629 except pythoncom.com_error as details:
    630     if details.hresult in ERRORS_BAD_CONTEXT:
    631         # May be a method.

com_error: (-2147352567, '发生意外。', (0, None, None, None, 0, -2147467259), None)

发生意外 means unexpected error