I want to search a "date" in my document. This date is 4x (the same date) in the document.
I want to change this in today's date.
The first date (to be found) is noted down as:
Date study: 02/01/2019.
This is a flemish (Belgium, Europe) notification, the 2nd of January, 2019.
Having started it in programming in VBA, things went wrong.
I declared some variables:
Dim strToday As String
Let strToday = Format(Now, "dd/mm/yyyy")
But: how do I select the "date" after the ":".
This must then be stored in a variable.
This variable can than be changed to strToday.
-what I made so far- but is not correct.
--------------------------------------------------
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Datum onderzoek:"
.Replacement.Text = "woensdag 20 februari 2019"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.MoveRight Unit:=wdWord, Count:=5, Extend:=wdExtend
Selection.Copy
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "16/03/2019"
.Replacement.Text = strToday
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub