View Single Post
 
Old 08-30-2014, 09:21 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,366
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

Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim StrOut As String
StrOut = " "
With Selection.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[A-Z]{2,}-[0-9A-Z\-]{1,}"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    If InStr(StrOut, " " & .Text & " ") = 0 Then StrOut = StrOut & .Text & " "
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
  .InsertAfter vbCr & Replace(Trim(StrOut), " ", ", ") & vbCr
End With
Application.ScreenUpdating = True
End Sub
With this code, each item will be listed once in the output, regardless of how often it appears in the input.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote