PrintDate in VBA

O

Ole

Hi everybody,

I need to get the Print Date into a document through VBA.

Right now, I use the command

Selection.TypeText (Str(Date))

This only uses the date the document was created. I see, I need a dynamic
field that changes every time, the document is printed, whereas my command
inserts a text.

Can anybody help me.

Thank you for your time

Ole
 
P

Peter Jamieson

Something like

Selection.Fields.Add _
Range:=Selection.Range, _
Type:=wdFieldDate, _
Text:="\@""DD MMM YYYY""", _
preserveformatting:=False

where you put the format you need instead of DD MMM YYYY

Peter Jamieson

http://tips.pjmsn.me.uk
 
M

macropod

Hi Peter,

I suspect wdFieldPrintDate might suit the OP's needs better than wdFieldDate.
 

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