View Single Post
 
Old 11-16-2015, 12:44 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
Sub MakeHyperlinks()
Application.ScreenUpdating = False
Dim oBkMrk As Bookmark, TblRng As Range, HLnkRng As Range, StrTxt As String, HLnk As Hyperlink
With ActiveDocument.Range
  .InsertAfter vbCr
  Set TblRng = .Characters.Last
  Set HLnkRng = .Characters.Last
  For Each oBkMrk In .Bookmarks
    With oBkMrk
      StrTxt = .Range.Text & vbTab & .Name
    End With
    With HLnkRng
      .Collapse wdCollapseEnd
      .Text = Split(StrTxt, vbTab)(0)
      Set HLnk = .Hyperlinks.Add(Anchor:=HLnkRng, SubAddress:=Split(StrTxt, vbTab)(1), _
        TextToDisplay:=Split(StrTxt, vbTab)(0))
      .End = HLnk.Range.End + 1
      .InsertAfter vbCr
    End With
  Next oBkMrk
  With TblRng
    .ConvertToTable Separator:=vbTab
    With .Tables(1)
      .Sort
      .ConvertToText
    End With
  End With
End With
Set HLnk = Nothing: Set TblRng = Nothing: Set HLnkRng = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote