How to override a date & time field with "Automatically Update" tu

J

Jeffery B Paarsa

Hello all,

On a .dot template I have date & time field with the “Update Automaticallyâ€
checked on. When I display the Userform to the user, I display the current
date on a Userform field to the user. %99 of the time the current date is
what it should be printed on the document but %1 of the time user may want to
override the date field displayed to him/her to another date or may be even
blank out the field so the form will be printed with blank date on it so it
can be filled manually. Considering that the date field on the .dot/.doc
file is not bookmarked I wonder how can I override this field with what has
been entered by the user on the Userform either blank or another date? Any
idea?
 
D

Dave Lett

Hi Jeff,

You could use something like the following:

Dim iFld As Integer

For iFld = ActiveDocument.Fields.Count To 1 Step -1
If ActiveDocument.Fields(iFld).Type = wdFieldDate Then
'''now you have programmatic access to your date field
Set oRng = ActiveDocument.Fields(iFld).Result
ActiveDocument.Fields(iFld).Unlink
oRng.Text = "change this value."
End If
Next iFld

HTH,
Dave
 

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