-3

Below code throws me error. which was working fine earlier.Not sure what happened now.Any help ?

import win32com.client as win32

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

wb=excel.Workbooks.Open('C:\Technical\AutomationScripts\Model_Variable_Path.xlsx')

excel.Visible = True


Trace Error 
File "C:\Technical\AutomationScripts\Testscript.py", line 2, in <module>
excel = win32.gencache.EnsureDispatch('Excel.Application')

File "C:\Program Files\Python39\lib\site-packages\win32com\client\gencache.py", line 625, in EnsureDispatch

mod = EnsureModule(tla[0], tla[1], tla[3], tla[4], bForDemand=bForDemand)

AttributeError: module 'win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9' has no attribute 'MinorVersion'

Tom Karzes
  • 22,815
  • 2
  • 22
  • 41

1 Answers1

0

for a start i will amend the spreadsheet file path from 'C:\Technical\AutomationScripts\Model_Variable_Path.xlsx' to r'C:\Technical\AutomationScripts\Model_Variable_Path.xlsx'