[python-win32] A problem on testing COM object with VBA

Xue Shan applejump at gmail.com
Fri Apr 4 16:38:53 CEST 2008


Hi all,
I'm a Python beginner and trying to run the codes from Chapter 5 of Python
pramming on win32. But when I tested the COM object with VBA,  I got an
error msg saying runtime error 438. Is there anyone can help me out? Thanks
in advance!

Here are the codes:
[Python]
class PythonUtilities:
    _public_methods_ = [ 'SplitString' ]
    _reg_progid_ = "PythonDemos.Utilities"
    _reg_clsid_ = "{D81903FB-62F2-4FB1-993E-63CAF4C963A0}"

def SplitString(self, val, item=None):
    import string
    if item != Nome: item = str(item)
    return string.split(str(val), item)

if __name__=='__main__':
     print "Registering COM server..."
     import win32com.server.register
     win32com.server.register.UseCommandLine(PythonUtilities)

After running above scripts,  the PythonWin interactive window displayed
Registering COM server...
Registered: PythonDemos.Utilities

[VBA]
Sub TestPython()

Set PythonUtils = CreateObject("PythonDemos.Utilities")
response = PythonUtils.SplitString("Hello from VB")
For Each Item In response
    MsgBox Item
Next

End Sub

The code stopped at "response = PythonUtils.SplitString("Hello from VB")".

-- 
Love. Peace. Music.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080404/c8df4d13/attachment.htm 


More information about the python-win32 mailing list