I am trying to open with Python an already open excel file, but I get an error before even providing the file path, in the following line:
xlApp = win32.Dispatch('Excel.Application', pythoncom.CoInitialize())
com_error Traceback (most recent call last)
~\anaconda3\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatch(IDispatch, clsctx)
88 try:
---> 89 IDispatch = pythoncom.connect(IDispatch)
90 except pythoncom.ole_error:
com_error: (-2147221021, 'Operação não disponível', None, None)
The words in Portuguese mean 'operation unnavailable'.
If I replace Excel.Application by Word.Application everything works fine. This problem started after a system reboot, though I am not sure if it is related. My OS is Windows 10 and my Office is 365. Any help will be greatly appreciated.