Python Forum

Full Version: Inserting input into Word doc bookmark
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey all,

I have a python script which asks for values from the user in a GUI in Windows, when the values are input, I want them to be placed in a bookmark in a pre formatted MS Word doc.

I have looked around for this before and found a number of options but found it can insert after the bookmark or before but not into it.

Any ideas?
I should have said the GUI is a Python/Tkinter GUI and the bookmark is an enclosed bookmark.
OK, got a little further, realised it wasn't a bookmark but a FormField with a Bookmark reference! Doh!

So now I can get the data into the FormField but having problems with the Unprotect/Protect command.

I can Unprotect the Doc fine but when I go to Protect() it, it disables inputting in the FormFields so now need help finding the correct syntax for Protect.