Table of Contents Page Numbers mixed up on Print Preview

I

Ianb

Hi I have a similar query to <owg> posted 3/4/2006 with no replies as follows:

"I use Word 2000 SP3. When I preview a document the numbers in Table of
Contents all become threes."

In my case I am using Word 2003 SP1. I am using cross references in my
header and footer that are updated from named form feilds in a locked page of
the document (the first page).

The problem seems to be that if there is a cross reference in the header or
footer the page numbers in the table of contents get mucked up when I use
print preview.

I don't want to remove the cross references from the header and footer so is
there a solution to the problem or a work around?

Thanks

Ian B
 
A

Ana Morales

Hi, Ian
I am having the same problem and have tried everything suggested in several
Word forums.
I would like to know if you finally found a workaround for this
I use Word 2003 SP2

Thanks in advance,
Ana
 
I

Ianb

Hi Ana

I'm not sure how much you know so forgive me if I'm teaching you to suck sggs

Since posting this I have found out that if you protect a Word document
(even a small section) it severely affects its operability - TOC, spelling
checkers etc don't perform.

I haven't found a way to resolve this here is my workaround I used. I was
protecting sections to support forms that held information in bookmarks so
that I could refer to them later in the document. Instead of doing this I
used a macro that starts when the user opens the document. It collects and
stores the information in the document properties - (the user can change them
by going into file.Properties etc). If the user doesn't change a property (or
the property is blank) it nags them each time they open the document. Then I
used the insert.field command in the document to use the properties in my
document.

There is a danger that a user will over type a reference in the document but
I'll live with that. Heres the code I used. Go to tools.macro.macros type
AutoOpen in the Macro name field and press create. Select all the text
presented in the windo and paste the following ... then play with it till it
does what you want

Hope that helps

Ian
---------------------------------

Sub AutoOpen()

' Store document variables in document properties
'
Dim bUpdated
MsgBox "This document contains fields that update automatically. If you
need to change the Project Name, Client or Contract Number after you have
specified them, update them in the File -> Properties dialog box"
bUpdated = 0
bUpdated = bUpdated + UpdateVar(wdPropertyAuthor, ActiveDocument, 2, 1,
"Please enter the name of the Document Owner", "Document Owner", "")
bUpdated = bUpdated + UpdateVar(wdPropertySubject, ActiveDocument, 2, 1,
"Please enter the name of the Project", "Project Name", "Project Name")
bUpdated = bUpdated + UpdateVar("Client", ActiveDocument, 2, 2, "Please
enter the name of the Project Client", "Client Name", "the Client")

' If bUpdated Then ActiveDocument.Fields.Update
ActiveDocument.Fields.Update

End Sub

Function UpdateVar(sVarName, oDocument, iMode, iVarChar, sVarDialogRequest,
sVarDialogTitle, sDefault)
'check and update variables in custom properties
' imode options as follows;
' 0 = replace value if exists (not supported)
' 1 = delete value if exists (not supported)
' 2 = ignore and return if exists otherwise update

' iVarChar (variable characteristics) as follows
' 0 = Word variable (not supported)
' 1 = Built in property
' 2 = Custom property

Dim temp, bChanged

bChanged = False

Select Case iVarChar
Case 1 ' built in property
' Test if contains a value
temp = ActiveDocument.BuiltInDocumentProperties(sVarName).Value
Select Case iMode
Case 2 ' ignore and return if exists otherwise update
If (Trim(temp) = "") Or (Trim(temp) = sDefault) Then
'ask for value and populate property
sVarValue = InputBox(sVarDialogRequest, sVarDialogTitle)
If sVarValue <> "" Then

ActiveDocument.BuiltInDocumentProperties(sVarName).Value = sVarValue
bChanged = True
End If
End If
Case Else
MsgBox "Error: inappropriate iMode in UpdateVar"
End Select
Case 2 ' custom property
'NOTE should probably test if property exists but as we are distributing
' the document with the custom properties and used for internal use is
acceptable
' Test if contains a value
temp = ActiveDocument.CustomDocumentProperties(sVarName).Value
' ActiveDocument.CustomDocumentProperties("Client").Value =
sClient
Select Case iMode
Case 2 ' ignore and return if exists otherwise update
If (Trim(temp) = "") Or (Trim(temp) = sDefault) Then
'ask for value and populate property
sVarValue = InputBox(sVarDialogRequest, sVarDialogTitle)
If sVarValue <> "" Then

ActiveDocument.CustomDocumentProperties(sVarName).Value = sVarValue
bChanged = True
End If
End If
Case Else
MsgBox "Error: inappropriate iMode in UpdateVar"
End Select

Case Else
MsgBox "Error: inappropriate iVarChar in UpdateVar"
End Select
UpdateVar = bChanged

End Function
 
A

Ana Morales

Hi, Ian

Thank you so much for your time and your very well documented reply.
Reading more carefully I have seen that my problem is not exactly the same
than yours but it is similar.

I am not using macros or locks. I am using cross references but not in the
header/footer, just inside the body of the document.

My document is simpler; however, I have the same problem with the page
number in the TOC when doing a preview. I am starting to think that it may be
a problem related with the version 2003.

I explained it like that in another post:

******

When I open a document and do Print Preview, all the page numbers in the
TOC are the same "1", "2" or “x†number.
If I close the Print Preview and then do Update Field, the numbers appear
correctly. The numbers print correctly if I print the document.

I have tried everything suggested in several Word forums and in the KB
(http://support.microsoft.com/kb/912940/en-us) but the problem is still there.

I am not using Reading Layout.
I am using footer with a floating image and without tables. I deleted the
floating image to see if that was the cause, but it still does the same.

Any suggestions?

Thanks in advance,
Ana
 
I

Ianb

Sorry Ana I can't think what it might be.

The symptoms are similar to when documents are protected. I have read some
posts (somewhere) that discuss known issues around putting tables and images
in the header and there are work arounds for this on the net.

I suggest you use a tried and true debugging method - get a working model
then make incremental changes until it falls over. Then you know your
problem. So create a new document, copy in the content without headers etc.
create your TOC, check if that still works, add the heade, see if that works
etc. If you keep versions of your changes you will be able to go back to the
last working version and resolve your problem from there.

Good luck :)
 

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