Thank you so much! Below's an alternative that someone suggested that will do the double dates. It works perfectly:
With Selection.Find
.Text = "<([0-9]{4})-([0-9]{4})>"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
.Execute
End With
dte = Selection.Range.Text
hdte = Split(dte, "-")
ndte = hdte(0) + 3760 & "-" & hdte(1) + 3760 & " (" & dte & ")"
With Selection.Find
.Text = dte
.Replacement.Text = ndte
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
.Execute , , , , , , , , , , True
End With
Originally Posted by
macropod
Try:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "<[0-9]{4}>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Execute
End With
Do While .Find.Found
.Text = CLng(.Text) + 3670
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
End Sub
PS: Your code is difficult to make sense of. When posting code, please use the code tags. They're on the 'Go Advanced'
tab.