I'm trying to get this program running.
I uses Python 3.7.2 in Win10 Enterprise (Version 10.0.17763 Build 17763) and the system is based on 64 bit.
I tried to make it work on several PCs. On some of them, it worked.
import win32com.client
o = win32com.client.Dispatch("Object.Name")
o.Method()
o.property = "New Value"
print(o.property)
o.prop_map_get_.keys()
o = win32com.gencache.EnsureDispatch('Excel.Application')
o.Visible = 1
o.Workbooks.Add()
o.Cells(1, 1).Value = "Hello"
Error :
Traceback (most recent call last):
File "test.py", line 2, in <module>
o = win32com.client.Dispatch("Object.Name")
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221005, 'Ungültige Klassenzeichenfolge', None, None)