public static void UpdateTocBookmark(Wd.TablesOfContents tocs) { var doc = (Wd.Document)tocs.Parent; if (tocs.Count > 0) { Wd.Range range = tocs.End(); Wd.Range attachment = FindFirstAttachmentStyle(doc, range); if (attachment != null && attachment.Find.Found) range.End = attachment.CollapseStart().Start - 2; // In case the Appendix starts with a content control else range.End = doc.Range().End; doc.Bookmarks.Add(Bookmark_TOCRange, range); } }