Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Protecting Bookmarks.
Written by Allen Wyatt (last updated May 7, 2019)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365
Jay asked if there was a way to protect a bookmark so it could not be deleted. There is no way to do this in Word; there is no way to set a bookmark as "hidden" or to lock it in place. You might think that you can mark a bookmark as hidden because when you display the Bookmark dialog box (Bookmark tool on the Insert tab of the ribbon) there is a check box named "Hidden Bookmarks." Word, in the normal course of using other tools, creates bookmarks that are normally hidden from view. For instance, Word uses hidden bookmarks for table of contents entries, cross-references, and captions. You cannot mark any of the bookmarks you create as "hidden," however. (See Figure 1.)
Figure 1. The Bookmark dialog box.
Bookmarks, hidden or not, can be deleted very easily. All a user needs to do is select the text that contains the bookmark and then delete that text. If the bookmark is one that you have created, the user can use the Bookmark tool on the Insert tab of the ribbon to find and delete the bookmark on purpose.
One way you can stop a bookmark from being deleted is to protect a document for forms. This type of protection allows you to specify specific sections in your document that are to be protected. If you put a continuous section break before the text containing the bookmark you want protected and a continuous section break afterwards, you can protect just the section that contains the bookmark. (How to protect individual sections in a document has been discussed in other issues of WordTips.)
Once you've applied the document protection, a user can no longer display the Bookmark dialog box to view what the different bookmarks are. This goes for any bookmarks in the document; the user won't be able to view the bookmarks in unprotected sections, either. The user can still select text in the unprotected sections of the document and delete that text, so it is possible to delete a bookmark in this way, but the same editing cannot take place in the protected section—so the bookmark there remains safe.
If you prefer to not divide your document into sections, another possible approach is to create a macro that protects the bookmarks. All you need to do is create a macro that is run every time the user makes a change to the document. The macro could check to make sure that your mandatory bookmark is still present. If it isn't, then the macro can undo the edit that triggered the macro in the first place.
Of course, such a macro will add a good deal of "overhead" to working with the document; running it after every character is added to a document or every character is deleted can be time consuming. There is no way around such an approach, however, since any document change can potentially affect your bookmark.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (7875) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Protecting Bookmarks.
Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!
Bookmarks are quite helpful in a document. You may want to transfer the contents of a bookmark into a macro variable in ...
Discover MoreNeed to get rid of a lot of bookmarks all at once? Word doesn't provide a way to do it, but you can use the short macro ...
Discover MoreWord allows you to create a cross-reference to several different types of content in your documents. For instance, you ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-04-21 09:22:38
Sergey
The point is that there is not any OnChange event available for MS Word Document to arrange a macro like you meant. Any suggestions?
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments