Office COM automatisation - calling python from VBA
Chris Smith
smitty_one_each at bigfoot.com
Fri Jun 24 18:07:16 EDT 2005
>>>>> "guy" == guy lateur <guy.lateur at pandora.be> writes:
guy> Hi all, I am trying to write some code (macro's, if you like)
guy> to glue together our Office applications (mainly Word, Excel
guy> and Outlook). We have a lot of different projects going on
guy> simultaneously. The idea is to develop a centralized
guy> framework (starting point, common interface) for my users to
guy> view/control their documents/correspondence, on a per project
guy> basis.
guy> As an example, I'd like to have a control (button, menu
guy> entry) in Outlook that allows my users to bring up, say, an
guy> email for a certain contact (architect, owner, engineer, ..)
guy> on a certain project, with certain attachments, .. Currently,
guy> I have a 'public folder' in OL (Exchange) that reflects our
guy> project structure.
guy> I'll be using COM, and I could probably make an application
guy> that controls Outlook (externally). But I'd also like to have
guy> this functionality exposed in OL itself. So I guess I'll need
guy> to use VBA, but I don't really like VBA - relax, please, it's
guy> just an opinion.. ;)
guy> So, ideally, I'd like to program as much as possible in
guy> python (I'm pretty new to that, too, btw), and only use VBA
guy> if needed - say, to call python objects/methods (+ wxGUI,
guy> please).
guy> Would that be an easy, a hard, or an insane strategy? Maybe
guy> there are some tutorials on this (searched the list, but
guy> didn't quite find any). If anyone happens to have any
guy> xp/tips on this, please, fire away!
guy> Best regards, g
You can have VBA code invoke a python script asynchronously without
much trouble.
If you peruse MSDN, you can find some examples that will let you have
VBA block while waiting on a python script.
Serious interaction? I'd probably persue VisualStudio and IronPython,
if ActiveState's PythonWin isn't going to be enough.
Maybe PythonWin can make Python a COM server; never researched it.
Hope these ideas help,
Chris
More information about the Python-list
mailing list