![]() |
|
#1
|
||||
|
||||
![]()
What the _Ref111185707 refers to is a hidden bookmark, not a cross-reference. In your attachment, that bookmark is applied to the '2'. Delete the hidden bookmark via the Insert|Bookmark dialogue (check the 'hidden bookmarks' option to see it) and all will be well.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
So glad you found this, can't wait to try your steps. I'm hoping I'll be able to do as you say via VBA. I'll try recording a macro of this and see if I can write a script to clean these up.
|
#3
|
|||
|
|||
![]() Quote:
I also found where these hidden bookmarks are coming from. I wasn't creating them directly, but as I was creating and deleting cross-references, Word was creating hidden bookmarks each time. I found this info from:Bookmarks.ShowHidden property (Word) | Microsoft Docs "Hidden bookmarks are automatically inserted when cross-references are inserted into the document." In case it helps someone else with a similar problem, here's my script to delete only hidden bookmarks from a document. Code:
Sub bhh_deleteHiddenBookmarks() ' Delete hidden bookmarks ' NOTE: Hidden bookmarks may be the result of inserting cross-references into the document, and removing the cross-reference. ' As found at: https://docs.microsoft.com/en-us/office/vba/api/word.bookmarks.showhidden ' "Hidden bookmarks are automatically inserted when cross-references are inserted into the document." ' Hidden bookmark names begin with an underscore _, like _Ref... Dim bool_showHiddenBms As Boolean Dim bms As bookmarks Dim bm As Bookmark Set bms = ActiveDocument.bookmarks bool_showHiddenBms = bms.ShowHidden ' Store original state for showing hidden bookmarks ' This option is a checkbox from Insert > Bookmark within Word. ' Ensure show hidden bookmarks is turned on for this script. bms.ShowHidden = True ' Loop through all bookmarks, delete hidden ones. For Each bm In bms If Left(bm.Name, 1) = "_" Then ' If the first character of .Name is an underscore, Debug.Print ("Deleting hidden bookmark: " & bm.Name) bm.Delete End If Next bm ' Set hidden bookmark option back to starting state bms.ShowHidden = bool_showHiddenBms Exit Sub End Sub ' bhh_deleteHiddenBookmarks |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
CrossReach | Word | 3 | 06-25-2019 03:00 PM |
About Cross-references | mohsen.amiri | Word | 1 | 01-19-2017 10:35 AM |
Convert manual cross references in footnotes to other footnotes to automatic cross references | ghumdinger | Word VBA | 7 | 11-20-2014 11:47 PM |
![]() |
acolussi | Word | 9 | 05-16-2013 02:11 AM |
![]() |
cure4glass | Word | 1 | 02-17-2012 07:19 PM |