Apologies for resurrecting this thread. This is almost the macro I need also, but I need endnotes instead of footnotes, and I need the page number of the initial selection to be put before the selected text in the endnote.
From working with this, it looks like I can just change the footnote references to endnote, but how do I put the page number of the selection in the footnote?
Quote:
Originally Posted by gmaxey
Next time, please try to fully define your requirements up front?
Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oFN As Footnote
Dim oRng As Word.Range
Dim strText As String
strText = Selection.Text
If Left(strText, 1) Like "[!?,.;:]" Then
strText = Left(strText, Len(strText) - 1)
End If
Set oFN = Selection.Range.Footnotes.Add(Selection.Range, , strText & ": ")
Set oRng = oFN.Range
oRng.MoveEnd wdCharacter, -2
oRng.Font.Italic = True
oRng.Collapse wdCollapseEnd
oRng.Move wdCharacter, 2
oRng.Select
End Sub
|