Updating Field Values 
Author Message
 Updating Field Values

Hi,

Is there a way to update all the field values in a
document at one time?

I used the following method:

'Just to apply F9
ActiveDocument.Selection.WholeStory
ActiveDocument.Selection.Fields.Update

I worked very fast with a good performance (completed in
100ms , 70KB file) But there is a problem: I could not
update the fields in the footers, headers, footnotes,
endnotes and textboxes... by this method. Because
Selection.WholeStory is selecting the whole document
except these parts.

Then, I tried the following way:

For Each aRange In ActiveDocument.StoryRanges
   aRange.Select
   Selection.WholeStory
   Selection.Fields.Update
Next

However, this method is very slow. It takes 5-7 seconds to
to update the fields of a document (size 60-70KB) Because
I went through the whole document. (I think it is not
necessary)

Now, does anybody have an idea about thsi problem? How can
I update all the fields at one time (or very quickly with
a good performance)?

Thanks,

Mahmut YILMAZ



Fri, 25 Feb 2005 19:48:12 GMT  
 Updating Field Values
Use the Range object instead of the Selection object.

--
http://www.standards.com/; Programming and support for  Word macros,
including converting from WordBasic to VBA; Technical reviewing; Standards;
Product functional/design/specifications
------------------------------------------------

Quote:
> Hi,

> Is there a way to update all the field values in a
> document at one time?

> I used the following method:

> 'Just to apply F9
> ActiveDocument.Selection.WholeStory
> ActiveDocument.Selection.Fields.Update

> I worked very fast with a good performance (completed in
> 100ms , 70KB file) But there is a problem: I could not
> update the fields in the footers, headers, footnotes,
> endnotes and textboxes... by this method. Because
> Selection.WholeStory is selecting the whole document
> except these parts.

> Then, I tried the following way:

> For Each aRange In ActiveDocument.StoryRanges
>    aRange.Select
>    Selection.WholeStory
>    Selection.Fields.Update
> Next

> However, this method is very slow. It takes 5-7 seconds to
> to update the fields of a document (size 60-70KB) Because
> I went through the whole document. (I think it is not
> necessary)

> Now, does anybody have an idea about thsi problem? How can
> I update all the fields at one time (or very quickly with
> a good performance)?

> Thanks,

> Mahmut YILMAZ



Fri, 25 Feb 2005 23:19:47 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Update Field Value

2. Updating Field Values

3. Updating Field Values

4. Updating Field Values

5. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

6. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

7. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

8. Updating field in form from summary value in another

9. Help with updating a field value

10. Updating Fields with Different Values?

11. Variable and field value changes after .Update in VBA

12. need help on getting the auto-increment value of a field BEFORE updating recordset

 

 
Powered by phpBB® Forum Software