View Single Post
 
Old 03-22-2021, 11:38 AM
RiSta RiSta is offline Windows 10 Office 2019
Novice
 
Join Date: Jun 2020
Posts: 7
RiSta is on a distinguished road
Default

Hello

Facing one problem with this macro - in some cases, after moving a footnote to a new position, footnote text accepts destination formatting. It happens when footnote text contains few lines devided by paragraph mark. Is it possible to modify macro so that is preserves footnotes original format.

Code:
Sub MoveFootNotes()
Application.ScreenUpdating = False
Dim RngSrc As Range, RngTgt As Range, f As Long
With ActiveDocument
  For f = .Footnotes.Count To 1 Step -1
    With .Footnotes(f)
      Set RngSrc = .Range
      Set RngTgt = .Reference
      RngSrc.End = RngSrc.End
      With RngTgt
        .Collapse wdCollapseStart
        .FormattedText = RngSrc.FormattedText
        .InsertBefore " ###"
        .Collapse wdCollapseEnd
        .InsertAfter "###"
        .Font.Reset
      End With
      .Delete
    End With
  Next
End With
Set RngSrc = Nothing: Set RngTgt = Nothing
Application.ScreenUpdating = True
End Sub

Last edited by macropod; 03-22-2021 at 01:56 PM. Reason: Added code tags
Reply With Quote