How can I improve this macro to:
1. list hyperlinks in order of occurrence;
2. delete blank lines;
3. allow it to be terminated with the Esc key?
1. list hyperlinks in order of occurrence;
2. delete blank lines;
3. allow it to be terminated with the Esc key?
Code:
Function GetAllHyperlinks()
'[URL]https://www.extendoffice.com/documents/word/1411-word-select-copy-all-hyperlinks.html#a2[/URL]
'Updateby20140214
Dim docCurrent As Document
Dim docNew As Document
Dim oLink As Hyperlink
Dim rng As Range
Application.ScreenUpdating = False
Set docCurrent = ActiveDocument
Set docNew = Documents.Add
For Each oLink In docCurrent.Hyperlinks
Set rng = docNew.Range
rng.Collapse
rng.InsertParagraph
rng.InsertAfter (oLink.Address)
Next
docNew.Activate
Application.ScreenUpdating = True
Application.ScreenRefresh
End Function
Last edited: