Need macro to get date in letter....

P

Paul Morris

I'm just a beginer with VBA for word. I've got a macro
that puts my address on a letter but I'd like to add the
date right after it. Is there anyway to do this by
recording the macro? If possible, can anyone send me the
code to get the date in. Thanks, Paul Morris...
 
C

Charles Maxson

You could insert a field code:

Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:="DATE \@ ""MMMM d, yyyy"" ", PreserveFormatting:=True

or just the date as text:

Selection.InsertAfter (Format(Now(), "Mmmm dd,yyyy"))

Also, you probably will want to use a

Selection.TypeParagraph

before and after to space your date on a different row... (or you could use
a Tab : Selection.TypeText vbTab)
 
M

Malcolm Smith

I'm just a beginer with VBA for word. I've got a macro
that puts my address on a letter but I'd like to add the
date right after it. Is there anyway to do this by
recording the macro? If possible, can anyone send me the
code to get the date in. Thanks, Paul Morris...


Paul

On my web site there is a tutorial on building a template and this ought
to answer your very question as well as getting you going in other areas.

- Malc
www.dragondrop.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