Why do I keep getting a type error: This COM object can not automate the makepy process - please run makepy manually for this object with excel?
Asked Answered
P

0

8

Before I ran the code and it worked, now when I changed nothing it throws me an error:

Traceback (most recent call last): File "C:\Python36-32\lib\site-packages\win32com\client\gencache.py", line 530, in EnsureDispatch ti = disp.oleobj.GetTypeInfo() pywintypes.com_error: (-2147418111, 'Call was rejected by callee.', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/matth/Desktop/dad_app/test.py", line 5, in excel = win32.gencache.EnsureDispatch('Excel.Application') File "C:\Python36-32\lib\site-packages\win32com\client\gencache.py", line 541, in EnsureDispatch raise TypeError("This COM object can not automate the makepy process - please run makepy manually for this object") TypeError: This COM object can not automate the makepy process - please run makepy manually for this object

import win32com.client as win32
import time
import sys
import pyautogui
pyautogui.alert("sdf")
stock = sys.argv[1]
excel = win32.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Open('C:\\xampp\\htdocs\\dad_app\\template\\template.xlsm')
ws = wb.Worksheets('Overview')
ws.Range("E8").Value = stock
time.sleep(10)
wb.SaveAs('C:\\xampp\\htdocs\\dad_app\\data\\' + stock + '.xlsm')
excel.Application.Quit()
pyautogui.alert(stock)
Paterfamilias answered 19/7, 2018 at 19:56 Comment(2)
im stuck on same issue :cLise
Was this resolved? I am facing the same issue now.Earplug

© 2022 - 2024 — McMap. All rights reserved.