Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-28-2020, 02:00 AM
in7el in7el is offline Can anyone help me with renaming of specific hyperlinks macro Windows 10 Can anyone help me with renaming of specific hyperlinks macro Office 2019
Novice
Can anyone help me with renaming of specific hyperlinks macro
 
Join Date: Jul 2020
Posts: 5
in7el is on a distinguished road
Default Can anyone help me with renaming of specific hyperlinks macro

So a user has macros to shorten hyperlinks in footnotes to "URL" for example, I need to reverse this and have a macro to change all hyperlinks named URL back to their full web url.



Can anyone assist?

I tried to find and replace but im not sure what to put as the new name in the entry field which would enable the renamed hypers to go back to their full url address.

Much appreciated.
Reply With Quote
  #2  
Old 07-28-2020, 05:16 AM
gmayor's Avatar
gmayor gmayor is offline Can anyone help me with renaming of specific hyperlinks macro Windows 10 Can anyone help me with renaming of specific hyperlinks macro Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Can you post an example document so that we can see what you are working with?
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 07-28-2020, 07:11 AM
in7el in7el is offline Can anyone help me with renaming of specific hyperlinks macro Windows 10 Can anyone help me with renaming of specific hyperlinks macro Office 2019
Novice
Can anyone help me with renaming of specific hyperlinks macro
 
Join Date: Jul 2020
Posts: 5
in7el is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
Can you post an example document so that we can see what you are working with?
Sure, thanks.

Original URL

Armed conflict location and event data project July 15th 2018-June 2020
https://exampleurl.com

Shortened.

Armed conflict location and event data project July 15th 2018-June 2020
url

I want to try and create a macro to switch the renamed hyperlinks labelled "url" back to the full web link like shown above.

thanks for your time.
Reply With Quote
  #4  
Old 07-28-2020, 07:41 AM
gmayor's Avatar
gmayor gmayor is offline Can anyone help me with renaming of specific hyperlinks macro Windows 10 Can anyone help me with renaming of specific hyperlinks macro Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Sorry but that doesn't help. We need to see an actual example in a document so that we can establish what the link actually contains.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #5  
Old 07-30-2020, 01:41 AM
gmayor's Avatar
gmayor gmayor is offline Can anyone help me with renaming of specific hyperlinks macro Windows 10 Can anyone help me with renaming of specific hyperlinks macro Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Based on this and your other post at Help to create a Word macro to change re-named Hyperlinks back to their full web addr the following should work. If not, do as Iasked and send a sample document.



Code:
Sub Macro1()
Dim oLink As Hyperlink
    For Each oLink In ActiveDocument.Hyperlinks
        If UCase(oLink.TextToDisplay) Like "*URL*" Then
            oLink.TextToDisplay = oLink.Address
        End If
    Next oLink
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #6  
Old 07-30-2020, 02:34 AM
in7el in7el is offline Can anyone help me with renaming of specific hyperlinks macro Windows 10 Can anyone help me with renaming of specific hyperlinks macro Office 2019
Novice
Can anyone help me with renaming of specific hyperlinks macro
 
Join Date: Jul 2020
Posts: 5
in7el is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
Based on this and your other post at Help to create a Word macro to change re-named Hyperlinks back to their full web addr the following should work. If not, do as Iasked and send a sample document.



Code:
Sub Macro1()
Dim oLink As Hyperlink
    For Each oLink In ActiveDocument.Hyperlinks
        If UCase(oLink.TextToDisplay) Like "*URL*" Then
            oLink.TextToDisplay = oLink.Address
        End If
    Next oLink
End Sub
Really appreciate the help, unfortunately that didn't work. I will make up a dummy document and provide it shortly. Bare with.
Reply With Quote
  #7  
Old 07-30-2020, 03:16 AM
in7el in7el is offline Can anyone help me with renaming of specific hyperlinks macro Windows 10 Can anyone help me with renaming of specific hyperlinks macro Office 2019
Novice
Can anyone help me with renaming of specific hyperlinks macro
 
Join Date: Jul 2020
Posts: 5
in7el is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
Based on this and your other post at Help to create a Word macro to change re-named Hyperlinks back to their full web addr the following should work. If not, do as Iasked and send a sample document.



Code:
Sub Macro1()
Dim oLink As Hyperlink
    For Each oLink In ActiveDocument.Hyperlinks
        If UCase(oLink.TextToDisplay) Like "*URL*" Then
            oLink.TextToDisplay = oLink.Address
        End If
    Next oLink
End Sub
I have attached a sample doc and ss of the two macros. Regards.
Attached Images
File Type: jpg Screenshot_1.jpg (57.9 KB, 19 views)
Attached Files
File Type: docx OriginalUrlSample.docx (11.7 KB, 6 views)
Reply With Quote
  #8  
Old 07-30-2020, 03:55 AM
Guessed's Avatar
Guessed Guessed is offline Can anyone help me with renaming of specific hyperlinks macro Windows 10 Can anyone help me with renaming of specific hyperlinks macro Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Try this code which toggles from one to the other
Code:
Sub ToggleURLs()
  Dim aHL As Hyperlink
  For Each aHL In ActiveDocument.Hyperlinks
    If aHL.TextToDisplay = "url" Then
      aHL.TextToDisplay = aHL.Address
    Else
      aHL.TextToDisplay = "url"
    End If
  Next aHL
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #9  
Old 07-30-2020, 06:33 AM
in7el in7el is offline Can anyone help me with renaming of specific hyperlinks macro Windows 10 Can anyone help me with renaming of specific hyperlinks macro Office 2019
Novice
Can anyone help me with renaming of specific hyperlinks macro
 
Join Date: Jul 2020
Posts: 5
in7el is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Try this code which toggles from one to the other
Code:
Sub ToggleURLs()
  Dim aHL As Hyperlink
  For Each aHL In ActiveDocument.Hyperlinks
    If aHL.TextToDisplay = "url" Then
      aHL.TextToDisplay = aHL.Address
    Else
      aHL.TextToDisplay = "url"
    End If
  Next aHL
End Sub
Legend thanks a lot
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can anyone help me with renaming of specific hyperlinks macro Macro: How to get this macro to save to a specific location LOUF Word VBA 1 12-07-2015 06:47 PM
Can anyone here tweek this macro for renaming Excel files based on a cell's contents? chrisd2000 Excel Programming 6 07-01-2014 01:53 PM
Macro Needed to bold specific lines and Macro to turn into CSV anewteacher Word VBA 1 05-28-2014 03:59 PM
Image Renaming Macro? jammer PowerPoint 5 07-15-2013 09:21 AM
Create Hyperlinks from Word to specific location in PDF sukanyae Word 0 02-25-2010 04:08 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft