A
ago
I am trying to make the win32com HelloWorld server work with a VBA
client but I get:
Run-time error '-2147467259(80004005)':
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.HelloHello"
_public_methods_ = ['Hello']
def __init__(self): pass
def Hello(self): return "Hello"
if __name__ == "__main__":
import win32com.server.register
import sys
#sys.argv.append("--debug")
win32com.server.register.UseCommandLine(HelloClass)
### PYTHON CLIENT (WORKS) ###
import win32com.client
obj = win32com.client.Dispatch('Python.HelloHello')
print obj.Hello()
### VBA CLIENT (ERROR 80004005 WHEN EXECUTING "CreateObject") ###
Public Sub test()
Dim obj As Object
Set obj = CreateObject("Python.HelloHello")
MsgBox obj.Hello("ago")
End Sub
client but I get:
Run-time error '-2147467259(80004005)':
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.HelloHello"
_public_methods_ = ['Hello']
def __init__(self): pass
def Hello(self): return "Hello"
if __name__ == "__main__":
import win32com.server.register
import sys
#sys.argv.append("--debug")
win32com.server.register.UseCommandLine(HelloClass)
### PYTHON CLIENT (WORKS) ###
import win32com.client
obj = win32com.client.Dispatch('Python.HelloHello')
print obj.Hello()
### VBA CLIENT (ERROR 80004005 WHEN EXECUTING "CreateObject") ###
Public Sub test()
Dim obj As Object
Set obj = CreateObject("Python.HelloHello")
MsgBox obj.Hello("ago")
End Sub