0

I have a Word document with hundred bookmarks. When I create a hyperlink to a bookmark inside the document, I have to choose which of the hundred bookmarks I want. Is there also a way to do this faster? For example, using a search feature in this menu, or just typing the name of the bookmark that I want to reference?

1 Answer 1

1

In Windows Desktop Word, the insert->hyperlink dialog seems to have become quite complicated for such a simple operation. I do not see any facility in there for filtering bookmarks or jumping to a particular point in the list. (In the Mac version, you can for example jump to the bookmarks beginning with M by typing M once you have opened up the list of bookmarks).

It sounds as if you know the bookmark names you want to use - if so, a simple VBA macro may do the trick, but I'm not going to attempt to describe the installation process here. But for example, the following will prompt for the bookmark name, then the "display text", then insert the necessary link at the Selection:

Sub insertHyperlinkToBookmark()

Dim hl As Word.Hyperlink
Dim bmname As String
Dim texttodisplay As String
bmname = InputBox("Enter the target bookmark name", "Insert hyperlink to bookmark step 1", "")
If bmname <> "" Then
  texttodisplay = InputBox("Enter the text to display", "Insert hyperlink to bookmark step 2", bmname)
  Set hl = Selection.Hyperlinks.Add( _
    Anchor:=Selection.Range, _
    Address:="", _
    SubAddress:=bmname, _
    ScreenTip:="", _
    texttodisplay:=texttodisplay)
    hl.Range.Fields(1).ShowCodes = False
End If
End Sub

You could modify that in various ways, e.g. to "do nothing" if the display text is empty.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .