View Single Post
 
Old 06-01-2011, 03:39 AM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Orifacious,

Try:
Code:
Sub MakeEndNotes()
Dim RngSel As Range, RngFnd As Range, StrNote As String
Application.ScreenUpdating = False
With Selection
  Set RngSel = .Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .MatchWildcards = True
    .Wrap = wdFindContinue
    .Forward = True
    .Text = "\<[!\>\<]{1,}\>"
    Do While .Execute = True
      Set RngFnd = ActiveDocument.Range(Start:=Selection.Start, End:=Selection.End)
      StrNote = Mid(RngFnd.Text, 2, Len(RngFnd.Text) - 2)
      ActiveDocument.Endnotes.Add RngFnd, , StrNote
      RngFnd.Text = vbNullString
    Loop
  End With
End With
RngSel.Select
Set RngFnd = Nothing: Set RngSel = Nothing
Application.ScreenUpdating = True
End Sub
Note: the code searches the selected range (or from the insertion point if nothing is selected)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 06-02-2011 at 06:49 PM.
Reply With Quote