First thing I do is copy them into Excel so that all links are in one column. I manually copied and pasted them into Excel from the Content Editor Web Part. Sometimes, I can get a whole lot of them, sometimes, just one or two at a time. If you are lucky, you will have a link list, that you can just open in datasheet view or export to Spreadsheet.
Put titles in your column in row 1:
- A: Bad Link
- B: Link Text
- C: Link URL
- D: New Link
- E: Category
- Place the cursor into an empty cell
- Click Record Macro from the Developer Tool ribbon
- Click OK to name the macro
- Type 'asdf' and press Enter
- Click Stop Recording from the Developer Tool ribbon
- Click Visual Basic from the Developer Tool ribbon
- Select Module1
- On the text area, (big area with the code in it) press [CTRL]+A to select all.
- Press [DELETE]
- Copy this code into the empty space:
Function GetAddress(HyperlinkCell As Range)
GetAddress =
Replace(HyperlinkCell.Hyperlinks(1).Address, "mailto:","")
End Function
Function GetText(HyperlinkCell As Range)
GetText=HyperlinkCell.Hyperlinks(1).TextToDisplay
End Function - Close the Visual Basic window
- Place this formula into Cell B2: =GetText(a2)
- Place this formula into Cell C2: =GetAddress(a2)
- Place this formula into Cell D2: =hyperlink(c2,b2)
- Fill out Column E with the category name for your link.
Now, you have all of the Link Titles and Link URLs in separate columns.
Now that you have the URL exposed, you can manage them. One thing this is really good for is getting rid of that pesky CTID in your URLs. You can also replace the space character with %20 so that the URLs work correctly when they used used elsewhere.
We have some alternate access mappings, so in order for these links to work properly for the proper audience, I use this method to quickly go through the links and change them to the correct 'field use' domain names.
No comments:
Post a Comment