[python-win32] Visual Basic
Tim Roberts
timr at probo.com
Mon Feb 6 18:06:45 CET 2006
On Sun, 5 Feb 2006 16:18:51 -0800, "Speers, Ted" <Ted.Speers at actel.com>
wrote:
>I'd like to redo all my Visual Basic Projects in Python ... I would
>have started down the Python path from the get-go but was in too much of
>rush. Now that I have a moment, I thought I'd get the help I need.
>
>I know how to connect to Excel:
>win32com.client.Dispatch("Excel.Application").
>
>How do I connect to a VisualBasic project?
>
>
I can't tell from the rest of the message what you mean by "connect
to". You can connect to a COM server; if your VB code serves COM
objects, you can create and manage them, just like you do with Excel.
If not, then there is no way to control them from the outside. It would
be like trying to connect to a C++ "Hello, world".
>If I can do this I'll be golden:
>
>Imagine an Excel Macro Start that does the following:
>
>Sub Start():
> Set form = MyUserForm
> load form
> form.show vbmodeless
> <run the Python module described below>
>end sub
>
>
Yes, but you can't really do that from Excel either, can you? If
MyUserForm is a VBA form within Excel, then there are ways you can do
this from Python using Excel's object model. But when you are using a
VB main program of your own creation, you have probably not created
enough COM objects for that level of control.
If you are switching to wxPython, then what you want to do is recreate
MyUserForm in wxPython code, and eliminate the VB code altogether.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32
mailing list