I am running this example of a RTD server.
I make the call in excel:
=RTD("Python.RTD.TimeServer","","seconds","5")
The first call works, but than it doesn't update anymore.
There is an error:
pywintypes.com_error: (-2147221008, 'CoInitialize has not been called.', None, None)
It happens when the excel callback is called:
self.__callback.UpdateNotify()
I am not an expert on the topic so my hypotheses are mostly guessing.
One thing I found is that in the beginning when you define the Excel type lib:
EXCEL_TLB_GUID = '{00020813-0000-0000-C000-000000000046}'
EXCEL_TLB_LCID = 0
EXCEL_TLB_MAJOR = 1
EXCEL_TLB_MINOR = 4
# Import the excel typelib to make sure we've got early-binding going on.
# The "ByRef" parameters we use later won't work without this.
gencache.EnsureModule(EXCEL_TLB_GUID, EXCEL_TLB_LCID, \
EXCEL_TLB_MAJOR, EXCEL_TLB_MINOR)
The Guid is not the same as of my excel application which is {00024500-0000-0000-C000-000000000046}.
I have tried, however than I get an error earlier in the EnsureModule function:
tlb = pythoncom.LoadRegTypeLib(typelibCLSID, major, minor, lcid)
pywintypes.com_error: (-2147319779, 'Library not registered.', None, None)
I saw someone manipulated the other variables for this call, but I don't even know what they are.
I have 64-bit Python and 64-bit Excel.
The Output from HKEY_LOCAL_MACHINE\software\classes\CLSID{00020830-0000-0000-C000-000000000046}:
Hive: HKEY_LOCAL_MACHINE\software\classes\CLSID\{00020830-0000-0000-C000-000000000046}
Name Property
---- --------
AuxUserType
Conversion
DataFormats
DefaultExtension (default) : .xlsx, Excel Workbook (*.xlsx)
DefaultIcon (default) : C:\Program Files\Microsoft
Office\Root\VFS\Windows\Installer\{90160000-000F-0000-1000-0000000FF1CE}\xlicons.exe,1
DocObject (default) : 16
Implemented Categories
InprocHandler32 (default) : ole32.dll
Insertable (default) :
LocalServer32 (default) : C:\Program Files\Microsoft Office\Root\Office16\EXCEL.EXE
MiscStatus (default) : 0
ProgID (default) : Excel.Sheet.12
TypeLib (default) : {00020813-0000-0000-C000-000000000046}
Verb
Version (default) : 1.6
VersionIndependentProgID (default) : Excel.Sheet