Hi Tim, Thank you very much for pointing out my mistakes. But, it still doesn't work because of runtime error 438. It seems in VBA it doesn't CreateObject sucessfully. Any ideas of solving it? Thanks a lot! Shan
2008/4/4, Tim Roberts <[EMAIL PROTECTED]>: > > Xue Shan wrote: > > 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) > > > The problem here is that "None" is misspelled inside SplitString. This > won't be noticed until SplitString is actually executed. > > By the way, since Python 2.x, you don't need to "import string" any > more. You can write that as: > > > def SplitString( self, val, item=None ): > > if item: item = str(item) > return str(val).split( item ) > > > -- > Tim Roberts, [EMAIL PROTECTED] > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- Love. Peace. Music.
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32