Hi all, I created a Word template, which contains a marker, that has to be replaced by some generated text (to be precise: it's a table, where one cell contains the marker text '__CONTENTS__'). I use easyword.py from "ppw32" to wrap word, the only substantial change I did was to rename the class to MSWord. So I added a method replacetText(self, old, new): def replaceText(self, old, new): f = self.wordSel.Find f.ClearFormatting() f.Text = old f.Replacement.ClearFormatting() f.Replacement.Text = new f.Execute(Replace=2, Forward=-1, Wrap=2) # ^ ^ ^...wdFindContinue # | |...True # |...wdReplaceAll return The test driver is: def test(): import os from time import sleep dirName = '%s\\' % os.getcwd() w = MSWord(dirName + 'ExTract.dot') w.show() w.replaceText('__CONTENTS__', 'Blah blah blah') # sleep(5) # w.close() return When executing this, word starts up, loads the template, and selects '__CONTENTS__'. Then nothing else happens. Especially, '__CONTENTS__' does not get replaced with "Blah blah blah". So I tried to do it from within Word, which works. So I tried to do it from within MSVB, which works too: Private Sub cbDoIt_Click() Dim Word As Word.Application Set Word = CreateObject("Word.Application") Word.Visible = True Word.Documents.Add "D:\\PyFL\\MSOffice\\exTract.dot" Selection.Find.ClearFormatting Selection.Find.Text = "__CONTENTS__" Selection.Find.Replacement.ClearFormatting Selection.Find.Replacement.Text = "Blah blah blah" Selection.Find.Execute Replace:=2, Forward:=-1, Wrap:=2 End Sub As I use ActivePython 2.0 on a NT4.0Svr/SP6 I tried 2.1.1.212 on an other machine (NT4.0Svr/SP6). Does not work either. Does anybody see, what I forgot to do/call to make it work from within Python too? Best regards Franz GEIGER -------------------------------------------------------- DATEC Datentechnik GmbH Software Development Retrieval Computing A-6890 LUSTENAU, Schmiedgasse 7 Tel +43 5577 630 04-0 Fax +43 5577 630 04-40 Mobile +43 664 214 57 43 E-Mail [EMAIL PROTECTED] WWW www.datec.at (in Partnerschaft mit Amazon.de) _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/activepython