Hello. I am trying to use the search and replace-function in MS Word. (Office 2003, XP and Activestate Python 2.3). It works great until I use non-english letters.
>>> from win32com.client import Dispatch >>> objWord = Dispatch("Word.Application") >>> objDoc = objWord.Documents.Open('c:/foo.doc') >>> objSelection = objWord.Selection >>> en = u'Kan man gjøre dette?' >>> to = u'Nå tryner det skikkelig' >>> objSelection.Find.Execute(en, False, True, False, False, True, True, 1, True, to, 2, False, False, False, False) gives the errormessage: Traceback (most recent call last): File "<interactive input>", line 1, in ? File "<COMObject <unknown>>", line 2, in Execute com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Word', 'The Find What text for a Find All Word Forms search can only contain alphabetic letters.', 'C:\\Program Files\\Microsoft Office\\OFFICE11\\1033\\wdmain11.chm', 25090, -2146822678), None) I have also tried: en = en.decode('latin-1') and en = en.decode('utf-8') but it still gives me the same error. If I type the sentences directly into Word, it works as a dream. How can I get around this problem? Thanks in advance. -- This email has been scanned for viruses & spam by Decna as - www.decna.no Denne e-posten er sjekket for virus & spam av Decna as - www.decna.no _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32