How to protect or recreate word bookmarks through VBA
Posted on 2008-09-29
I have a word template that I am creating. The user opens word, a userform pops up and asks them to fill in several text boxes. After submitting, the text boxes populate word bookmarks, including bookmarks in the header of the file. This all works correctly. However, if the user then changes one of the values and deletes the bookmark then I have a problem.
After the values are populated, I can run a macro to send those bookmark values to an access database. If the bookmark is deleted then I get an error when submitting to the database.
I would like to know how to either protect the bookmarks from deletion or somehow add them back if they are modified and deleted.