By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,550 Members | 1,161 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,550 IT Pros & Developers. It's quick & easy.

A problem on testing COM object with VBA

P: 1
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(PythonUtil ities)

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")".
Apr 4 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.