[Tutor] COM server: cannot assign property
Yashwin Kanchan
yashwinkanchan at gmail.com
Fri Nov 13 01:41:44 CET 2009
Hi Guys
I am trying to create a simple test COM server , but am have trouble
assigning any property value to it through excel VBA.
Please point out where i am going wrong.
#COM server
class test(object):
_reg_clsid_ = "{B5901450-F9A1-4F76-8FCF-2BFFA96ED210}"
_reg_progid_ = "Python.Test"
_public_methods_ = ["arg"]
_public_attrs_ = ["t"]
def __init__(self):
self._t=0
def arg(self,s,r):
return (s,r)
def get_t(self):
return self._t
def set_t(self,value):
self._t = str(value)
t = property(get_t,set_t)
if __name__=='__main__':
import win32com.server.register
win32com.server.register.UseCommandLine(test)
print "done"
VBA Code:
Sub Button1_Click()
Set test = CreateObject("Python.Test")
test.arg 2, 5
test.t = "hello"
MsgBox test.t
End Sub
Error; "Object doesnt support this property or method" at test.t = "hello"
Thanks
Yashwin Kanchan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091113/aac66077/attachment.htm>
More information about the Tutor
mailing list