Numpages field not updating
Numpages field not updating - dianna agron and trevor donovan dating
It also happened to me that the page references all pointed to page 1 in the document when I used Active Document. Update, but it worked when I updated them manually. It seems that something changed between Word 2007, where I wasn't having problems with this macro, and 2013.After some trial and error I noticed that it worked using Selection. Update, so I modified the macro to the following: Sub Update All Fields() Dim o Current Rng As Range Dim o Rng As Range Application.
(If you wonder about some other fields, these are IF fields, presenting text in Dutch or English, depending on the value of Custom Document Property "Taal" (= Dutch for "Language").) Whatever I do, in Word itself or through VBA code, I cannot get this field on page 1 to update, unless this field, and only this field(! The NUMPAGES field on page 1 is in a frame in the body. Update End If Next fld End Sub Executing this code does not update the Num Pages field. The document is based on a mandatory company "housestyle" template that we have to use "as is". Select Insert | Bookmark, and specify a (unique) name for the bookmark, e.g. The code still won't update it, but printing/print previewing should update it. And adding pages leads to updated and correct values of "Num Pages" on page 1. Count Sometimes I'm not on my own work-PC when I come into the Lounge and then I cannot upload.Screen Updating = False Set o Current Rng = Selection. Melissa has a document that begins with a title page.i, too, wish there was a way to get fields to update in documents by default, or at least without resorting to macros (which are disabled and difficult).The "filename" field in particular is my pain point.And yes, the if then else statement wasn't complete. 'This can take a while when the document gets large Set obj Doc = Active Document For Each obj Fld In obj Doc. Type Case wd Field Ref, wd Field Page, wd Field Num Pages, wd Field Sequence obj Fld. I manually updated the page numbers on page 2 of 2 of my document and running this macro reset them to 1 of 1.
I previously had multiple if statements and thought maybe that was the problem, so I reformatted it as you see above. The macro runs fine but just updates the page numbers to the wrong value. Update End Select Next obj Fld Protect Document End Sub Thanks. I also commented out the sub functions to ensure they weren't causing a conflict, and yet the problem persists.
), is selected and then F9 is pressed or Selection. Not all fields in such a frame are updated automatically. Deleting pages also works OK, unless there's only 1 page left. Range Dim o Fld As Field For Each o Range In Active Document. So I typed it in and made a typo; in reality I use the same syntax as you did.
Unfortunately, you cannot move this frame "as is" to the header, since it contains form fields. In that case after updating or with printpreview it says 1 of 2.... In the meantime, I discovered some other strange behaviour regarding my global code-only-template, so I'll investigate the possibillity of corruption.
The following is an example of an Auto Open macro you can use.
Note that the macro makes sure that the options are set to force updating the fields and links when printing occurs, then it updates all the members of the Fields collection in the document.
This can take a while when the document gets large Set obj Doc = Active Document For Each obj Fld In obj Doc. Type = wd Field Ref Then 'Updates Cross References obj Fld. Type = wd Field Page Then 'Updates Page Numbers obj Fld. Type = wd Field Num Pages Then 'Updates Total Page Count obj Fld. Type = wd Field Sequence Then 'Updates Sequence Fields obj Fld.