Thread: [Solved] Loop Macro to Edit Date
View Single Post
 
Old 02-21-2014, 12:01 AM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,385
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

In that case, only a few minor changes to the previous code are required, being nothing more that deleting the day parts of the date references:
Code:
...
StrRep = Format(DateAdd("d", -1, CDate(Month(Now()) & "/1/" & Year(Now()))), "MMMM YYYY")
...
      .Text = "[ADJMO][abceghlmnorstuy]{2,7} [12][0-9]{3}"
      .Execute Replace:=wdReplaceAll
      .Text = "February [12][0-9]{3}"
      .Execute Replace:=wdReplaceAll
      .Text = "[AJSN][beilmnoprtuv]{4,8} [12][0-9]{3}"
...
Indeed, all of:
Code:
      .Text = "[ADJMO][abceghlmnorstuy]{2,7} [12][0-9]{3}"
      .Execute Replace:=wdReplaceAll
      .Text = "February [12][0-9]{3}"
      .Execute Replace:=wdReplaceAll
      .Text = "[AJSN][beilmnoprtuv]{4,8} [12][0-9]{3}"
could be reduced to:
Code:
      .Text = "<[JFMASOND][a-ceg-il-pr-vy]{2,8} [12][0-9]{3}>"
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote