View Single Post
 
Old 03-21-2024, 06:22 AM
fd110 fd110 is offline Windows 10 Office 2021
Novice
 
Join Date: Nov 2023
Posts: 7
fd110 is on a distinguished road
Default Send text to footnote without losing comment

I got a macro from a friend of the site that sends the text to the footer keeping the formatting
Now my problem is that when I have a comment in that text field, I lose that comment
I wanted, if possible, to send the comment to the number of the footnote in the text before sending the text to the footnote, so that I don't lose the comment.

Code:
Sub Macro1()
Dim oRng As Range, oFN As Footnote, rngInner As Range
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(FindText:="\[\[(*)\]\]", MatchWildcards:=True)
Set oFN = ActiveDocument.Footnotes.Add(oRng, , oRng.Text)
Set rngInner = oRng.Duplicate
rngInner.MoveStart Unit:=wdCharacter, Count:=2
rngInner.MoveEnd Unit:=wdCharacter, Count:=-2
oFN.Range.FormattedText = rngInner.FormattedText
oRng.Text = ""
Loop
End With
lbl_Exit:
Set oRng = Nothing
Set rngInner = Nothing
Exit Sub
End Sub


Thank you very much, I have another problem.
I have a number of comments in the text, which will be deleted by moving the text to the footnote.
Is there a way to move those comments, for example, to the footnote number in the main text and not delete them?
Reply With Quote