PDA

View Full Version : [SOLVED:] Replace hyperlink with the text it points to



Wonderer
01-06-2021, 01:30 PM
I have a Word file with hundreds of hyperlinks to small sections of formatted texts in various other (rather large) Word files. These formatted text sections are bookmarked in their respective Word files (that's where the hyperlinks point to).

I need to replace each hyperlink with the formatted text it points to, i.e. not with the name of the bookmark, but with the corresponding text.

Practically, the user - instead of having to click on the hyperlink to see the relevant text - will see the text itself in the main document.

I have no experience with VBA, so I am hoping that someone has a ready VBA macro that does the job.

Thank you for any help.

macropod
01-06-2021, 07:05 PM
You can do this via Find/Replace - no code required.

1. Press Alt-F9 to toggle Word's field code display 'on'
2. Use a wildcard Find/Replace, where:
Find = HYPERLINK ("*")*("*")
Replace = INCLUDETEXT \1 \2
3. Press Alt-F9 to toggle Word's field code display 'off'
4. Press Ctrl-A, F9
Done.

Note: The content is still linked to the source, so changing it there will result in the destination content updating also. If you don't want that, you can break the links.

Wonderer
01-06-2021, 07:58 PM
Hi Paul,
Thank you so much. It certainly did the trick.:thumb:thumb:thumb
:hi: