Using a selection object in a range other than the body of the document might be where the problem is coming from. Or perhaps the txtName textbox is no longer available.
If you tried using Range instead of Selection you may get it working better. Note that 'replacing text at a bookmark' is normally problematic as the contents of the bookmark are removed and the text appears beside (not inside) the bookmark unless steps are taken to handle this. See the following thread for inspiration
https://www.msofficeforums.com/word-...-bookmark.html