using the current date IN an exisiting document

J

Joepie

Hello,

Probably the solution is rather simple. I have a log. I renew it every year
(open a new document/file on jan 1). Every day I want to write something in
that log, I want to start the text with naming the current date. Nor DATE
(changes all the dates mentioned tot the current system day), nor CREATEDATE
(uses only the date the document was created, e.g. jan 1) are sufficient.
What do I have to do to put in the (fixed) date I wrote the text?
Thanks
 
D

Doug Robbins - Word MVP

The simplest thing for you to do is go to the Insert tab of the Ribbon and
in the Text section of the Ribbon, click on the Date & Time item and select
the format for the date that you want to use and make sure that you do NOT
check the Update automatically box. When you do that, the current date will
be inserted as ordinary text and will not update when you save or print the
document.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

Graham Mayor

You could use Insert > Date & Time and uncheck the 'update automatically'
check box, which will insert the date as text using one of a varietry of
formats based on the local language settings (you can pick the language from
those installed from the dropdown box at the top of the dialog box).

An alternative solution if you want to save a few keystrokes is to use a
macro to insert the date as text in the format you require. The following
will insert the current date at the cursor.

Sub InsertUSFormatDate()
With Selection
.InsertDateTime DateTimeFormat:="MMMM" & Chr(160) & _
"d," & Chr(160) & "yyyy", InsertAsField:=False
End With
End Sub

in the format
November 30, 2008

You can amend the format by changing the format switch (Chr(160) is a
non-breaking space)
http://www.gmayor.com/installing_macro.htm

If you want to insert a different date see
http://www.gmayor.com/insert_a_date_other_than_today.htm

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

Joepie

Doug, hello,

What a quick reaction! Thanks.
The problem with your solution is that it doesn't show the date as I want
it: zondag 30 november, which is the way you write the sequence sunday
november 30 in Dutch. I tried to do it with a macro, but didn't find the
right solution there.
 
G

Greg Maxey

You could do that with a macro like this:

Sub DateStamper()
Dim oRng As Word.Range
Set oRng = Selection.Range
oRng.Text = LCase(Format(Date, "dddd dd MMMM"))
End Sub
 
J

Joepie

You got me what I wanted, thanks Doug, Greg and Graham!
Now I do have a latest question: How can I assign a shortkey to an already
existing macro?
 
G

Graham Mayor

You can assign shortcut keys via the link at the bottom of the QAT editor -
(Word Options > Customize).

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Suzanne S. Barnhill

In the Date and Time dialog, you can select a specific format and make it
the default. If the format you want is not displayed, that's because you
don't have it selected as your default Long Date format in Control Panel |
Regional and Language Options. Once you've selected the default in the Date
and Time dialog, you can insert a DATE field using Alt+Shift+D and
immediately unlink it using Ctrl+Shift+F9. On the whole, however, I think it
would be much simpler in your case just to type the date manually.
 
J

Joepie

Nice extra solution, thanks

Suzanne S. Barnhill said:
In the Date and Time dialog, you can select a specific format and make it
the default. If the format you want is not displayed, that's because you
don't have it selected as your default Long Date format in Control Panel |
Regional and Language Options. Once you've selected the default in the Date
and Time dialog, you can insert a DATE field using Alt+Shift+D and
immediately unlink it using Ctrl+Shift+F9. On the whole, however, I think it
would be much simpler in your case just to type the date manually.

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

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