Applying Field Formatting Automatically in Word 2003

D

Dave

I'm using Word 2003 and trying to populate fields with data using
result.text=<Data>. So if wdField is a Word.Field object that I want to
populate I use wdField.Result.Text=<Data>. It puts the data in there, but
when I enter data into a formatted field like a date field, the formatting is
not applied unless I arrow through the fields in the document - when the
field is exited, the formatting is applied correctly. Is there a way to get
this format applied when the data is entered? I tried using wdField.Update,
but that didn't do it.

Thanks,

Dave
 
D

Dave

Thanks for the reply, Stefan. The ActiveDocuments.Fields.Update does not do
the trick. I am putting 1/14/07 12:01 PM into a date field that has format
MM/dd/yyyy. The field shows 1/14/07 12:01 PM in the document but will not
change (to 01/14/2007) unless I select the field and then exit the field
(using keyboard or mouse). I want it to change to the formatted text right
when I enter the text.

The document is protected. Maybe that has something to do with it?
Interestingly, the ActiveDocuments.Fields.Update call clears the fields when
the document is not protected. Also when not protected, the date field never
formats itself, even after using mouse and keyboard to get in and out. Hmm.


Dave
 
S

Stefan Blom

I misunderstood your original message; I didn't realize that you were
referring to form fields. They are a different kind of fields, and
there is also a different collection for them: the Formfields
collection.

As far as I know, there is no way to force an update of a form field,
but someone else might know better.

--
Stefan Blom
Microsoft Word MVP


in message
 

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