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)
网友评论