update a word-bookmark with the win32.com extension

Christian Lehmann docelm at web.de
Tue Nov 18 08:42:22 EST 2003


Hello,

I want to update a bookmark in a word file.
My code looks like this:

def UpdateBookmark(BookmarkToUpdate, TextToUse):
    FieldRange = Document.Bookmarks(BookmarkToUpdate).Range 
    FieldRange.Text = TextToUse        # error message
    ActiveDocument.Bookmarks.Add(BookmarkToUpdate,FieldRange)


UpdateBookmark ("Bookmarkname","newString")


when i assign the new string an error message occurs.
I m using Office XP...

Thanks
Christian




More information about the Python-list mailing list