Text field in text box does not update on Fields.Update( )
by StefanM » Sat, 14 Feb 2009 08:28:23 GMT
Hi,
I have a german word 2003 document that contains some (auto-) text
fields that get filled via a program (using Word's ActiveX interface).
After all text fields are set I call Fields.Update( ) method. All
fields get updated except the address field. This field is in a text
frame (not sure about the exact Word terminus beause I'm using a
german word version, maybe it's called text box).
Once the document prints, it gets updated automatically. Or by
clicking the field and hitting F9. But at first the user thinks that
something went wrong because he just sees "R_Address" (the field name)
in the the text box.
Is there any way to update this field with VBA/macro, too?
TIA,
Stefan
Re: Text field in text box does not update on Fields.Update( )
by Gordon Bentley-Mix » Sat, 14 Feb 2009 09:00:17 GMT
Stefan,
Because text boxes (the English term) are in a different story from the main
document, Fields.Update doesn't update the fields in them. You could write
code to address this problem by cycling through all of the stories in the
document (and all of the shapes in each story), but there is a "shortcut"
workaround using the .PrintPreview method. This should update all fields in
the document automatically - especially since you say that the fields are
updating correctly when the document is printed. The code is as simple as:
ActiveDocument.PrintPreview
ActiveDocument.ClosePrintPreview
--
Cheers!
Gordon Bentley-Mix
Word MVP
Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
Re: Text field in text box does not update on Fields.Update( )
by TGVuZSBGcmVkYm9yZw » Sat, 14 Feb 2009 09:36:00 GMT
Note that not all types of fields are updated when changing to Print Layout
view and back. The following article describes which fields are updated in
which situations:
http://www.**--****.com/
If auto-) textmeans that the fields inserted are of the type AutoText, I
am afraid they will not update using the Print Layout method (neither
according to the article nor to the test I just made).
A macro that updates all fields can be used instead. You will find such
macro here:
http://www.**--****.com/
Alternatively, you could convert the text box to a frame. Fields in frames
will be updated together with ormaltext since a frame resides in the text
layer of the document. Conversion to frame can be made via the Text Box tab
in the Format Text Box dialog box.
--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
>
> Stefan>
>>
> Because text boxes (the English term) are in a different story from the main>
> document, Fields.Update doesn't update the fields in them. You could write>
> code to address this problem by cycling through all of the stories in the>
> document (and all of the shapes in each story), but there is a "shortcut">
> workaround using the .PrintPreview method. This should update all fields in>
> the document automatically - especially since you say that the fields are>
> updating correctly when the document is printed. The code is as simple as>
>>
> ActiveDocument.PrintPrevie>
> ActiveDocument.ClosePrintPrevie>
> -->
> Cheers>
>>
> Gordon Bentley-Mi>
> Word MV>
>>
> Uninvited email contact will be marked as SPAM and ignored. Please post all>
> follow-ups to the newsgroup>
>>
>>
>> > Hi>
>> >
>> > I have a german word 2003 document that contains some (auto-) tex>
>> > fields that get filled via a program (using Word's ActiveX interface)>
>> > After all text fields are set I call Fields.Update( ) method. Al>
>> > fields get updated except the address field. This field is in a tex>
>> > frame (not sure about the exact Word terminus beause I'm using >
>> > german word version, maybe it's called text box)>
>> >
>> > Once the document prints, it gets updated automatically. Or b>
>> > clicking the field and hitting F9. But at first the user thinks tha>
>> > something went wrong because he just sees "R_Address" (the field name>
>> > in the the text box>
>> >
>> > Is there any way to update this field with VBA/macro, too>
>> >
>> > TIA>
>> > Stefa>
>> >>
>
Re: Text field in text box does not update on Fields.Update( )
by StefanM » Sat, 14 Mar 2009 21:31:36 GMT
n 13 Feb., 01:36, Lene Fredborg < XXXX@XXXXX.COM >
wrote:
> am afraid they will notupdateusing the Print Layout method (neither>
> according to the article nor to the test I just made).>
>>
> A macro that updates all fields can be used instead. You will find such>
> macro here:http://www.gmayor.com/installing_macro.htm>
>>
> Alternatively, you could convert thetextbox to aframe. Fields in frames>
> will be updated together with ormalextsince aframeresides in thetext>
> layer of the document. Conversion toframecan be made via theTextBox tab>
> in the FormatTextBox dialog box.>
>>
> -->
> Regards>
> Lene Fredborg - Microsoft MVP (Word)>
> DocTools - Denmarkwww.thedoctools.com>
> Document automation - add-ins, macros and templates for Microsoft Word>
>>
>>
>>
> "Gordon Bentley-Mix" wrote:>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
> - ZitiertenTextanzeigen -
Lene,
first sorry for answering a bit late but first I was out of office and
then "out of order"...
thanks for pointing me in the right direction of different "Stories"
inside a word document. I now also call update for the fields in the
other stories and now the document displays correctly
Thank you!
Stefan
Similar Threads:
1.Field updates on print even though Update Fields not checked
Hello we've got a doc with the date originally inserted and doc saved in the
past (just date, not createdate field). Even though
Tools|Options|Print|Update Fields is not checked, it updates the field when
we print. Please advise, user indicates it never used to do this and we
can't use createdate for other reasons. Please advise--thanks much in
advance.
2.update field placed in Text Box on the header and footer of a word document
Hi
i have been working on a word document, where i have added a field {REF
Name} (this field refer to a bookmark in the document) into Text Box. and i
have placed the Text Box in the headerAndFooter of the document. the issue
is to get the updated field in the whole document.
i have wrote a macro that does the update, everything works fine.
the problem start when i lock(protect) the document, and i run the macro an
error happens.
the following is the code that i used
1) ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
2) Selection.HeaderFooter.Shapes("Text Box 05").Select
3) Selection.WholeStory
4) Selection.Fields.Update
5) ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
the first line checks
the 2end select the Text Box
the 3rd select the text
the 4th update
the 5th return to the mainDocument
i would realy love to get help, it means so much to me.
i'm using 2004 word,
thank you for your help
3.Update field codes in text boxes
Hello everyone,
I just discovered using "Cross-reference" for linking text to figures, and
it's changed my life. (Well, at least my Senior Design report.)
However, I noticed that all the captions I've placed in text boxes (when the
figure has "Tight" text wrapping) do not update even when I use Ctrl+a and
hit F9. Is there any way to make sure they update as well?
Thanks,
Matthew Pfluger
4.How do I update field values inside a text box
Using CTL+A followed by F9 updates all fields except those in a text box.
Currently I have to select each text box manually and then press F9 to
refresh the field.
Is there a better way?
5.Update field within a text box
I'm using Word 2007.
I created a template with a REF field in a text box that refers back to a
bookmark created with an ASK field earlier in the document. When I create a
new document using this template, all of the ASK and FILLIN prompts come up,
but the REF field in the text box does not update automatically. If I click
in the text box and hit F9, it will update, but I would like it done
automatically. Is this possible?
TIA
David
6. Update Fields In Text Boxes
7. Fields in Text Boxes Don't Update
8. Automatically fill a text box when a field is updated