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

Re: Applying Field Formatting Automatically in Word 2003 by Stefan

Stefan
Wed Mar 21 02:20:18 CDT 2007

ActiveDocument.Fields.Update should update all fields in the body of
the document. For a macro to force an update of fields in all stories
(that is, including headers, footers, text boxes, etc.), see
http://www.gmayor.com/installing_macro.htm.

--
Stefan Blom
Microsoft Word MVP


"Dave" wrote in message
news:2AD1273E-4F62-4F3D-AAF9-AD35F4228161@microsoft.com...
> 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
>





Re: Applying Field Formatting Automatically in Word 2003 by Dave

Dave
Wed Mar 21 08:40:10 CDT 2007

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


"Stefan Blom" wrote:

> ActiveDocument.Fields.Update should update all fields in the body of
> the document. For a macro to force an update of fields in all stories
> (that is, including headers, footers, text boxes, etc.), see
> http://www.gmayor.com/installing_macro.htm.
>
> --
> Stefan Blom
> Microsoft Word MVP
>
>
> "Dave" wrote in message
> news:2AD1273E-4F62-4F3D-AAF9-AD35F4228161@microsoft.com...
> > 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
> >
>
>
>
>
>

Re: Applying Field Formatting Automatically in Word 2003 by Stefan

Stefan
Wed Mar 21 09:05:56 CDT 2007

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


"Dave" wrote in message
news:8BF78B17-DEC4-4C1D-8095-584B3C608FB2@microsoft.com...
> 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
>
>
> "Stefan Blom" wrote:
>
> > ActiveDocument.Fields.Update should update all fields in the body
of
> > the document. For a macro to force an update of fields in all
stories
> > (that is, including headers, footers, text boxes, etc.), see
> > http://www.gmayor.com/installing_macro.htm.
> >
> > --
> > Stefan Blom
> > Microsoft Word MVP
> >
> >
> > "Dave" wrote in message
> > news:2AD1273E-4F62-4F3D-AAF9-AD35F4228161@microsoft.com...
> > > 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
> > >
> >
> >
> >
> >
> >