Maybe I should have just asked how to deal with this first.
xlapp=win32com.client.Dispatch("Excel.Application")
book=xlapp.Workbooks("bookname")
VBProj=book.VBProject
...
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: [EMAIL PROTECTED] on behalf of Tim Roberts
Sent: Mon 2/6/2006 9:06 AM
To: [email protected]
Subject: Re: [python-win32] Visual Basic
On Sun, 5 Feb 2006 16:18:51 -0800, "Speers, Ted" <[EMAIL PROTECTED]>
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, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32
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.
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32