pageref woes

I

ip

I am using word 2000 with sp 3. In my document I have to create a weird
TOC: the "chapter names" entries are to be in blue but leader dots and
page numbers in black. The only way I figured out how to do that is to
bookmark the chaptes and construct each "TOC entry" as hyperlink to
the chapter bookmarks + pageref field to the bookmark.
On top of this, I have a VBA macro users need to run to accomplish
other tasks (include files, break links to the included files etc). I
made sure that bookmarks are NOT in included files but in the main
document. This macro also updates fields to show correct page numbers
in TOC - or is supposed to - and here is the problem:

Not all pageref fields in TOC get updated. BTW the pageref are wrong
on screen, but the links work properly...clicking on pageref brings me
to the correct place in the document

If I manually "select all" and press F9 repeteadly several times,
eventually all fields get updated.

So here is the first problem, as the whole process needs to be
automated, I need to be able to implement updating fileds in VBA macro.
I even tried puting Timer in VBA, waiting 10 secnds and updating fields
again, doing this several times, but no cigar.

Also, if I update fieldd manually (so they are all OK) and then switch
to print preview (and back), the pageref fields revert back to
original dummy values. (and yes, option update fields on print is
selected)

Does anyone have a clue why is this happening? Anyone else have seen
something like this? Other articles in this group suggest that PAGEREF
is supposed to work better than sectionpages field or numpages fields,
but for me it seems to be opposite...

Any help will be appreciated

ip
 
I

ip

Partially answering my own question:

selection.EndKey unit:=wdstory
selection.HomeKey unit:=wdstory
ActiveDocument.Fields.Update

with this piece of code, all fields are updated properly. PrintPreview
still messes them up though...
 

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