Python Forum
Inserting input into Word doc bookmark - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Inserting input into Word doc bookmark (/thread-26006.html)



Inserting input into Word doc bookmark - shappaeye - Apr-18-2020

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?


RE: Inserting input into Word doc bookmark - shappaeye - Apr-20-2020

I should have said the GUI is a Python/Tkinter GUI and the bookmark is an enclosed bookmark.


RE: Inserting input into Word doc bookmark - shappaeye - Apr-21-2020

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.