Hi George
I would have thought that "h:mm am/pm" should format the time as, eg, "11.40
am", but it doesn't. However the Format() function does seem to work as
advertised, so we can get the system time using the Time() function, and
format it using the Format() function.
Your original macro will insert the date (albeit with the wrong format) and
replace any currently selected content. If you accidentally ran the macro
with lots of text selected, you would get what might be called 'unexpected
results'! So it's wise to collapse the selection before you insert the date.
Here's a macro that will collapse the selection, insert the date as, eg,
"11:45 am" and then leave the cursor at the end of the newly-inserted text.
Sub InsertDateForGeorge()
With Selection
.Collapse Direction:=wdCollapseStart
.InsertAfter Format(Time(), "h:mm am/pm")
.Collapse Direction:=wdCollapseEnd
End With
End Sub
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word