[python-win32] Visual Basic

Speers, Ted Ted.Speers at actel.com
Mon Feb 6 19:10:00 CET 2006

Maybe I should have just asked how to deal with this first.
com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Office Excel', 'Programmatic access to Visual Basic Project is not trusted\n', 'C:\\Program Files\\Microsoft Office\\OFFICE11\\1033\\xlmain11.chm', 0, -2146827284), None)
It appears to me that I need to sign my Project for Python will let me see it ... is there a workaround?


From: python-win32-bounces+ted.speers=actel.com at python.org on behalf of Tim Roberts
Sent: Mon 2/6/2006 9:06 AM
To: python-win32 at python.org
Subject: Re: [python-win32] Visual Basic

On Sun, 5 Feb 2006 16:18:51 -0800, "Speers, Ted" <Ted.Speers at actel.com>

>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:
>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.

Python-win32 mailing list
Python-win32 at python.org

This information contained or attached to this e-mail may be subject to the Export Administration Regulations (EAR) or the International Traffic in Arms Regulations (ITAR) and may require an approved export license prior to its export.  An export can include a release or disclosure to a foreign national inside or outside the United States.  Include this notice with any reproduced portion of this information.

More information about the Python-win32 mailing list