打开excel时 报错0x800AC472 急解决办法

2019-12-16  本文已影响0人  Shirley_3ec8

excel = win32.gencache.EnsureDispatch('Excel.Application')

time.sleep(3) #否则报错

wb = excel.Workbooks.Open(resultfile)

报错0x800AC472

============================================

解决方法:

windows RUN里运行:

"C:\Program Files (x86)\Microsoft Office\Office16\EXCEL.EXE" /regserver

其中office16取决于版本

然后又报错:com_error: (-2147418111, 'Call was rejected by callee.', None, None)

------------------------------------------------------------------------------------

解决方法:加sleep.

excel = win32.gencache.EnsureDispatch('Excel.Application')

time.sleep(3) #否则报错

wb = excel.Workbooks.Open(resultfile)

上一篇下一篇

猜你喜欢

热点阅读