PDA

View Full Version : Help to create a Word macro to change re-named Hyperlinks back to their full web addr



in7el
07-29-2020, 02:23 AM
Hi hoping someone can help me with this its been going on for days now and I cannot seem to find a solution.

There are reports written in word, which have a macro to rename the hyperlinks in the footnotes to say "URL" for example. This is done in order to decrease the size of the document itself.

My question was if someone is able to help me reverse this procedure and create a macro to actually change the renamed hyperlinks back to their full web address.

I am able to do this manually to each one by going to edit the hyperlink and removing the "URL" title. This changes the "URL" name back to the original full web address.

I have tried to record a macro of highlighting the "URL" hyperlinks and editing this way but it only goes from a specific range and doesn't actually change the name of the hyper.

Below I will provide the macro and hopefully, someone is able to assist me with this. I'm not sure what to put in the new name " " field, if I leave it blank it doesn't work.

______________________________________________________

Sub hyperlinks()
Dim IngTemp As Long
For IngTemp = 1 To Selection.hyperlinks.Count
Selection.hyperlinks(IngTemp).TextToDisplay = "url" <<< This is the field im unsure what to put

Next
End Sub

gmayor
07-29-2020, 07:52 AM
Duplicate post at https://www.msofficeforums.com/word-vba/45383-can-anyone-help-renaming-specific-hyperlinks-macro.html