View Single Post
 
Old 10-28-2021, 08:18 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Following down the recreating path, perhaps this workflow will get you started. This uses an array to store the footnote entries as strings in an array and tag the locations. It then puts unformatted content into a new document and rebuilds the footnotes based on the tags inserted.
Code:
Private Sub NewDocPlusFootnotes()
  Dim arrFN() As String, aFN As Footnote, iFN As Integer
  Dim xDoc As Document, xNewDoc As Document, aRng As Range
  
  Set xDoc = ActiveDocument
  With xDoc
    'Get the footnotes into a string array
    If xDoc.Footnotes.Count > 0 Then
      '.Footnotes.StartingNumber = 0
      ReDim arrFN(1 To xDoc.Footnotes.Count)
      For Each aFN In .Footnotes
        aFN.Reference.InsertBefore "<fNote "
        aFN.Reference.InsertAfter "/>"
        arrFN(aFN.Index) = aFN.Range
      Next aFN
    End If
  End With
  
  'Create new document and fill with plain text
  Set xNewDoc = Documents.Add
  xNewDoc.Range.Text = xDoc.Range.Text      'unformatted text into new doc
  
  'rebuild the footnotes
  Set aRng = xNewDoc.Range
  With aRng.Find
    .ClearFormatting
    For iFN = LBound(arrFN) To UBound(arrFN)
      .Text = "<fNote " & Chr(2) & "/>"
      If .Execute = True Then
        aRng.Text = ""
        xNewDoc.Footnotes.Add Range:=aRng, Text:=arrFN(iFN)
      End If
      aRng.Collapse Direction:=wdCollapseEnd
    Next iFN
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote