View Single Post
 
Old 08-13-2015, 05:25 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

You could do that with a macro like:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "<[0-9]{1,2} [JFMASONDanuryebchpilgstmov]{3,9} [12][0-9]{3}>"
    .Replacement.Text = ""
    .Forward = True 
    .Format = False
    .Wrap = wdFindStop
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found = True
    If .Characters.First.Information(wdActiveEndAdjustedPageNumber) _
      <> .Characters.Last.Information(wdActiveEndAdjustedPageNumber) Then
      .HighlightColorIndex = wdBrightGreen
    End If
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
but I'd have to question why you're doing this. If the aim is to ensure the dates are not split across page boundaries, you could use a macro like:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Text = "<([0-9]{1,2}) ([JFMASONDanuryebchpilgstmov]{3,9}) ([12][0-9]{3})>"
  .Replacement.Text = "\1^s\2^s\3"
  .Forward = True
  .Format = False
  .Wrap = wdFindContinue
  .MatchWildcards = True
  .Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
PS: When posting code, please use the code tags, indicated by the # button on the posting menu.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote