Help with COM example from the PPWin32 book

Will Ganz wganz at
Tue Dec 4 08:39:09 CET 2001

Windows 98SE, Excel2000, PythonWin 2.1.1 (#20, Jul 26 2001, 11:38:51)
HP-6648C(K6-2 550 w/192megs RAM, 20gig hd w/11gig free)

The COM example on pages 68/69 from the 'caiman' book doesnt work. Gives a
error of 438 when VBA code from Excel is executed.

>>>>>> <<<<<<<<<<<<<<
#simple COM Server demo

class PythonUtilities:
    _public_methods_ = [ 'SplitString' ]
    _reg_progid_ = "PythonDemos.Utilities"
    _reg_clsid_ = "{B91A4120-E716-11D5-9D0B-FFFFFF000000}"

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

if __name__ == '__main__':
    print "Registering COM server . . . . . . . ."
    import win32com.server.register

Invoked with c:\>python
Registering COM server . . . . . . . .
Registered: PythonDemos.Utilities

In PythonWin Editor goto
COM browser
Registered Categories
Python COM Server
IID: PythonDemos.Utilities, double click to get

So, I know that this is registered. Right??

In Excel's VBA Editor the following code is entered

Sub TestPython()

Set PyUtil = CreateObject("PythonDemos.Utilities")
response = PyUtil.SplitString("Hello from Python")

For Each Item In response
    MsgBox Item

End Sub

Invoked by clicking on the Run button on the toolbar and it gives an error

Run-time error '438'
Object doesn't support this property or method

When Debug is clicked, the yellow highlight is on this line:

response = PyUtil.SplitString("Hello from Python")

Yes, I have RTFM, RTFFAQ, STFA(Searched the archive), BMFB(Bought more
books), RTFT(Read those too), used Google, looked at Mark Hammond's site &
looked at his ppt files, and all to no avail.

Does anyone know what is going on here??

Thanks for the help,


More information about the Python-list mailing list