Hello. I have put together this code but it seems I missed something.
All help is appreciated greatly.
1 2 3 4 5 6 7 8 9
Sub ReplaceTextCurrentPage() Dim txtFIND As String Dim txtREPLACE As String txtFIND = ActiveDocument.FindShape("date") txtREPLACE = CStr(Date) ActivePage.TextReplace txtFIND, txtREPLACE, True, False End Sub
nailed it Eskimo. Thanks for your help and thanks Mek.
Note that one can get the date and time using Now, and can then use Format to create the formatted string. That gives some flexibility in getting date and time (and, really, other stuff) in the way you want.
This shows a few examples:
Sub show_date_time_examples() MsgBox CStr(Now) MsgBox Format(Now, "yyyy-mm-dd") & vbCrLf & vbCrLf & Format(Now, "mm/dd/yyyy") & vbCrLf & vbCrLf & Format(Now, "mmmm d, yyyy - h:m AM/PM") End Sub
That gives this:
and then this:
grogo said:nailed it Eskimo. Thanks for your help and thanks Mek.
Hey, I learned something new - that Page.TextReplace doesn't seem to go after shapes on master layers.
Some of the stuff involving master layers just gives me fits.