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

martin keller m.r.keller at gmx.de
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

MK


import win32com.client
import tkFileDialog

# Launch Word
MSWord = win32com.client.Dispatch("Word.Application")
MSWord.Visible = 0 
# Open a specific file
myWordDoc = tkFileDialog.askopenfilename()
MSWord.Documents.Open(myWordDoc)
#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 http://www.gmx.net/de/go/mail




More information about the Python-list mailing list