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

Xue Shan applejump at gmail.com
Fri Apr 4 18:55:04 CEST 2008


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 <timr at probo.com>:
>
> 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, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>



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


More information about the python-win32 mailing list