[python-win32] More VisualBasic

Tim Roberts timr at probo.com
Thu Feb 9 02:17:02 CET 2006


On Wed, 8 Feb 2006 11:28:16 -0800, "Speers, Ted" <Ted.Speers at actel.com>
wrote:

>I'm sure I'm destined to be a consumer of versus a contributor to this
>group's output.
>  
>

We all started out that way.

>I'd like to get some advice from the group whether I should pursue the
>road I'm on ... 
>Am I on a fools errand trying to develop an application in Python that
>manipulates VBUserForms?  Are these errors that I'm seeing going to be
>the bane of my existence due to some inherent flakiness or, through
>experience/reading/discussiongroups/magic, will I be able to gain enough
>understanding of how things work so that I can consistently avoid these
>pitfalls?
>  
>

Here's my personal opinion, remembering that free advice is usually
worth exactly what you paid for it.   If you really need to be working
with VBA forms in Excel, you will just hurt yourself to try to control
them with anything other than VBA.

It is quite possible to control Excel from Python; you can feed
information into and out of cells in worksheets, and format it to your
heart's content.  It is quite possible to write a Python app with a UI,
using tkinter or wxPython or whatever floats your boat, and have the
events in that UI tickle Excel.  However, if the UI was done in VBA, and
must remain in VBA, then you probably want to manipulate the UI with
VBA.  Getting a VBA form to fire a Python event is difficult.

Don't think of VBA as part of Excel.  Think of it as a separate language
that happens to hook into the Excel object model.  That's exactly what
Python is.  Both of them can manipulate Excel, but it's a lot of work to
have one of them manipulate the other.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list