instantiate multiple automation objects
Yoon S. Choi
ychoi at pipeline.com
Sun Jun 4 00:22:58 EDT 2000
I am trying (without much luck) to create multiple instances of an
automation object. I can create 1 instance correctly using the
function call win32com.client.Dispatch(). However, when I use the
same function to try and create another automation object, it just
refers to the first instance.
Here is an example using Microsoft Word as the automation object:
import win32com.client
w1 = win32com.client.Dispatch( "Word.Application")
w2 = win32com.client.Dispatch( "Word.Application")
w1.Visible = 1 # Microsoft Word becomes visible
w2.Visible = 1 # Nothing happens because w2 is referring to the same
object as w1
How can I for example create another instance of Microsoft Word? In
other words, w1 and w2 would refer to two separate automation objects
of the same type.
Can I do this without having to resort directly to the pythoncom
module and its associated CoCreateInstance and CoGetClassObject
functions?
More information about the Python-list
mailing list