View Single Post
 
Old 04-07-2025, 03:12 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,387
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 use a wildcard Find/Replace, with
Find = <[MTWFS][ondayueshrit]{2,7} [JFMASOND][anuryebchpilgstmov]{2,8} [0-9]{1,2} [0-9]{2,4}*^13
Replace = ^&
setting the replacement font to 14pt bold.
This will capture the dates regardless of whether the days & months are abbreviated or written out in full and whether the years are 2-digit or 4-digit.

If there is anything else on the line before the date, change the '<' at the start of the Find expression to '[!^13]@'

No macro required.

As a macro, it becomes:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Replacement.Font.Bold = True
    .Replacement.Font.Size = 14
    .Execute FindText:="<[MTWFS][ondayueshrit]{2,7} [JFMASOND][anuryebchpilgstmov]{2,8} [0-9]{1,2} [0-9]{2,4}*^13", _
    ReplaceWith:="^&", MatchWildcards:=True, Forward:=True, Format:=True, Wrap:=wdFindContinue, Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote