How to capture just the visible content of a COM object?

martin keller m.r.keller at
Sat Sep 11 16:51:08 CEST 2004

Hello all,

can somebody tell me how do I capture just the visible text (for the user)
of a COM object (in this case a WordDoc object)?

The following code is working fine, but the last line must be rewritten to
capture what I need...

Thanks to you all in advance


import win32com.client
import tkFileDialog

# Launch Word
MSWord = win32com.client.Dispatch("Word.Application")
MSWord.Visible = 0 
# Open a specific file
myWordDoc = tkFileDialog.askopenfilename()
#Get the textual content
docText = MSWord.Documents[0].Content

NEU: Bis zu 10 GB Speicher für e-mails & Dateien!
1 GB bereits bei GMX FreeMail

More information about the Python-list mailing list