I am trying to make the win32com HelloWorld server work with a VBA
client but I get:
Run-time error '-2147467259(8000 4005)':
Automation error
Unspecified error
I googled for the error but the suggested solutions (commenting out
_reg_class_spec _ and putting the server on the python path) do not seem
to make any difference (to be precise, unless I comment out
_reg_class_spec _ I cannot register the server at all) . The server
works under the python client but not on excel vba. I also tried to
debug with win32traceutil. py but I can only see the trace when using
the python client, not with excel. Any hint would be appreciated.
### PYTHON SERVER ###
class HelloClass:
_reg_desc_ = "Python Test COM Server"
_reg_clsid_ = "{91281AFC-25DF-4400-8868-FDBFCA2612A2}"
_reg_progid_ = "Python.HelloHe llo"
_public_methods _ = ['Hello']
def __init__(self): pass
def Hello(self): return "Hello"
if __name__ == "__main__":
import win32com.server .register
import sys
#sys.argv.appen d("--debug")
win32com.server .register.UseCo mmandLine(Hello Class)
### PYTHON CLIENT (WORKS) ###
import win32com.client
obj = win32com.client .Dispatch('Pyth on.HelloHello')
print obj.Hello()
### VBA CLIENT (ERROR 80004005 WHEN EXECUTING "CreateObje ct") ###
Public Sub test()
Dim obj As Object
Set obj = CreateObject("P ython.HelloHell o")
MsgBox obj.Hello("ago" )
End Sub