Share via

Automatically Updating Tooltip Text

Anonymous
2012-12-19T14:25:26+00:00

Hello everyone,

I have a document with defined terms in a definition section.  When those terms are used later in the document, I would like to hyperlink back to the definition, and have a tooltip with the text of the definition pop-up as well.

The problem is, the definitions are likely to change, and I'd like to avoid updating a dozen+ tooltips each time I need to tweak a definition.  Is there any way to set things up so that the tooltip text automatically updates?  Alternatively, is there any work arounds (such as a small pop-up window or frame) that I could use to refer back to the definition without having to constantly navigate around the document.

Thanks,

Auz

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Jay Freedman 207.7K Reputation points Volunteer Moderator
2012-12-19T15:24:36+00:00

There is a solution by using the following macro, subject to a couple of restrictions. Each time you make an update, or just once before you distribute the document, open the document and then run the macro. (See http://www.gmayor.com/installing_macro.htm if you need instructions.)

Sub SetTooltips()

    Dim HL As Hyperlink

    Dim BK As Bookmark

    With ActiveDocument

        For Each HL In .Hyperlinks

            If HL.Address = "" And HL.SubAddress <> "" Then

                If .Bookmarks.Exists(HL.SubAddress) Then

                    Set BK = .Bookmarks(HL.SubAddress)

                    HL.ScreenTip = Left(BK.Range.Text, 250)

                End If

            End If

        Next

    End With

End Sub

The restrictions: First, each definition must be surrounded by a bookmark, and the hyperlinks must be created to point to the bookmarks. (That's how you get a hyperlink with a blank address and the bookmark's name in the hyperlink's subaddress.)

Second, if the definition is longer than 250 characters, only the first 250 will appear in the tooltip. I don't remember offhand whether the length limit imposed by Word is 254 or 255, so I used 250 to be safe.

You can run the macro more than once on the same document. It will always update all of the tooltips in any hyperlinks that point to bookmarks.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2012-12-20T05:37:28+00:00

    Jay,

    Thanks a ton.  It works like a charm (and on the first try, non-the-less).

    Auz

    Was this answer helpful?

    0 comments No comments