View Single Post
 
Old 02-11-2016, 06:01 AM
mdhg mdhg is offline Windows 10 Office 2013
Novice
 
Join Date: Feb 2016
Posts: 10
mdhg is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
Maybe something like
Code:
Sub Macro1()
Dim oRng As Range
Dim strText As String
Dim i As Long
    Set oRng = ActiveDocument.Range
    i = 1
    With oRng.Find
        Do While .Execute(FindText:="\[\[(*)\]\]", _
                          MatchWildcards:=True, _
                          ReplaceWith:="\1")
            ActiveDocument.Footnotes.Add oRng, CStr(i), oRng.Text
            i = i + 1
            oRng.Collapse 0
        Loop
    End With
lbl_Exit:
    Set oRng = Nothing
    Exit Sub
End Sub

This works, thank you so much! (I'm not the one to judge, but: I looks really elegant too.)
Just one thing: The text between the brackets isn't deleted. It is transfered to the footnote, but it stays in the main art as well. How can I adapt the code get rid of the text in the main part?
Thanks!
Reply With Quote