using an already running COM object with Dispatch

Roger Upole rupole at hotmail.com
Sun Aug 6 04:01:24 EDT 2006


"jiccab" <jicman at gmail.com> wrote in message news:1154715278.972215.295040 at 75g2000cwc.googlegroups.com...
> Greetings.
>
> with the following code,
>
> olApp = Dispatch("Outlook.Application")
>
> I am capable of getting a new instance of Outlook running.  I would
> like to be able to use the instance that is already running, if exists,
> otherwise open a new one.
>
> Has anyone being able to do this?

You should be able to use
win32com.client.GetActiveObject('outlook.application')
and fall back to a normal Dispatch if it fails.

     Roger





More information about the Python-list mailing list