Mulverine
03-18-2015, 09:24 AM
Hello
I am trying to run a VBA Macro that searches a document for the word effdate and then asks the user to input a date (string) and then replaces the effdate word with the typed date.
This is what I have so far but it only highlights the word, asks for a date with a textbox but then does not replace it with the typed date.
Public Sub UserDate()
Dim strDate As String
strDate = InputBox("Insert date in format dd/mm/yy", "User date", Format(Now(), "dd/mm/yy"))
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.Text = "effdate"
.Replacement.Text = "strDate"
.Execute
End With
End Sub
Any help is appreciated!
I am trying to run a VBA Macro that searches a document for the word effdate and then asks the user to input a date (string) and then replaces the effdate word with the typed date.
This is what I have so far but it only highlights the word, asks for a date with a textbox but then does not replace it with the typed date.
Public Sub UserDate()
Dim strDate As String
strDate = InputBox("Insert date in format dd/mm/yy", "User date", Format(Now(), "dd/mm/yy"))
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.Text = "effdate"
.Replacement.Text = "strDate"
.Execute
End With
End Sub
Any help is appreciated!