View Single Post
 
Old 08-30-2018, 03:35 PM
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

Perhaps you should ask yourself when is it ever correct for a paragraph to end with trailing spaces or for a hyperlink to start or end with one. I know of no such situation. It seems to me your faulting the code I posted for no good reason. If anything, the code I posted might have exposed flaws in your footnote content and/or formatting. The solution is to fix your footnotes, not criticise the code for exposing the flaws. That said, you might try:
Code:
Sub Demo()
Dim Hlnk As Hyperlink, FtNt As Footnote, Rng As Range
With ActiveDocument
  For Each FtNt In .Footnotes
    Set Rng = FtNt.Range.Paragraphs.Last.Range
    With Rng
      If .Hyperlinks.Count > 0 Then
        With .Hyperlinks(.Hyperlinks.Count)
          If .Range.End = Rng.End - 1 Then
            .TextToDisplay = Trim(.TextToDisplay)
            .Address = Trim(.Address)
          End If
        End With
      End If
      Do While .Characters.Last.Previous.Text = " "
        .Characters.Last.Previous.Text = vbNullString
      Loop
    End With
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote