Hi there!
I use the following macro, which was kindly constructed by macropod:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Range, FtNt As Footnote
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "\[\!*\!\]"
.Replacement.Text = ""
.Forward = True
.Format = False
.Wrap = wdFindStop
.MatchWildcards = True
.Execute
End With
Do While .Find.Found
If .Characters.Last Like "[" & vbCr & vbTab & Chr(11) & Chr(160) & " ]" Then
.Characters.Last.Font.Reset
.End = .End - 1
End If
Set Rng = .Duplicate
.Collapse wdCollapseStart
Set FtNt = .Footnotes.Add(.Duplicate)
Rng.Start = FtNt.Reference.End
FtNt.Range.FormattedText = Rng.FormattedText
Rng.Delete
If .End = ActiveDocument.Range.End Then Exit Sub
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
End Sub
I'm having trouble making a small change. This macro transforms text between "[!" and "!]" into footnotes. But I'd like to also exclude those signs, "[!" and "!]" in the final result, that is, the content of the footnote. For example:
- In the body: [!This is x.!]
- In the footnote: This is x.
I guess I'd have to write make another line in the macro, but I don't have any idea of what I should write there.
Somebody could help?
Thank's!