How Do I Enter Time With One Key??

G

Guest

I have a log that I keep in Word. I would like to enter the time (system)
with the single stroke of a key. I don't know how I had it set up at one
time, but cannot find out how I set up the macro. Can someone please help? I
have tried to record a new macro and assign it to a key, but that does not
work. Unless I am doing something wrong.
 
E

Ed

Look at the Word Help topic for "Insert the current date and time". Start
the macro recorder and step through the instructions. Assign that to a
keystroke combination.

Ed
 
S

Suzanne S. Barnhill

There is a built-in keyboard shortcut for inserting the date and time:
Alt+Shift+D inserts the date/time in the format selected as default in the
Insert | Date and Time dialog. But it inserts it as a Date field, which will
update whenever you open the document. This is not what is wanted. You could
indeed record a macro of opening the Date and Time dialog and inserting the
date and time with "Automatically update" not checked, and you could even
assign it to Alt+Shift+D, but I'm not entirely sure it wouldn't insert a
Date field if that box ever got checked.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
D

Daiya Mitchell

The recorded macro may specify that the date should not update. I'm not
sure if I entirely recorded or partially edited this example:

Selection.InsertDateTime DateTimeFormat:="d MMMM yyyy", InsertAsField:= _
False

This won't work for the original question, as it doesn't specify time.
 
G

Graham Mayor

Sub InsertTimeLowerCase()
With Selection
.Collapse Direction:=wdCollapseStart
.InsertAfter Format(Time(), "h:mm" & Chr(160) & "am/pm")
.Collapse Direction:=wdCollapseEnd
End With
End Sub

See http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top