Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TOC with same page number (WORD 2003)

    Hi

    We have found that for some of our documents the TOC is set to the same number when we open it while OK for some. There is no pattern to the documents or contents. It just depends how WORD feels at the time of opening the document.
    If I print preview the 'erroneous' document - it most times fixes the TOC problem but not always. It almost seems as if it is a display problem rather then the actual problem with the document.

    I am getting lots of calls from the users complaining about the non-updating of the TOC & I just normally tell them to print preview and they are mostly happy. I am just getting fed of receiving so many calls on this.

    Is there a solution to this problem? Can I perhaps print preview the document when I open it (it is based on a template)? Any other solutions?

    Thanks.

    Robie.
    Thanks.
    Robie

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: TOC with same page number (WORD 2003)

    I don't know if The page numbers in the table of contents are incorrectly displayed when you open a document in Word 2003 or in Word 2002 is relevant.

    You could create a Document_Open event procedure in the ThisDocument module of the template:

    Private Sub Document_Open()
    On Error Resume Next
    ActiveDocument.TablesOfContents(1).UpdatePageNumbe rs
    End Sub

    or if you prefer to use print preview:

    Private Sub Document_Open()
    On Error Resume Next
    Application.ScreenUpdating = False
    ActiveDocument.PrintPreview
    ActiveDocument.ClosePrintPreview
    Application.ScreenUpdating = True
    End Sub

    This will be run automatically each time a document based on the template is opened.

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TOC with same page number (WORD 2003)

    Thanks very much Hans. Now why didn't I think of looking into the MS knowledgebase! My first port of call has always been the forum. How good you guys are.

    BTW: I used the first option 'ActiveDocument.TablesOfContents(1).UpdatePageNumb ers' previously but I found that it would take forever to repginate the document - I don't know why it would do that if we are just updating the page numbers. I will try it out again (until someone complains of the time of repagination).

    Thanks Hans. You are too good.

    Robie
    Thanks.
    Robie

  4. #4
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TOC with same page number (WORD 2003)

    Thanks Hans. Except for the ActiveDocument.TablesOfContents(1).UpdatePageNumbe rs nothing works. ActiveDocument.TablesOfContents(1).UpdatePageNumbe rs takes too long for some of our documents and therefore not really possible to use.

    Print Preview and swapping between normal/print view (as per MS KB article - this works when done manually but not within a macro) doesn't make any difference to the TOC. Perhaps those actions are too fast. May be I need to put some sort of 'pause' between the two sets of actions. If I put a break point & stop before continuing then it works fine. I have played with screenupdating options etc but to no avail. This is how my macro looks (testing options uncommented):

    Private Sub Document_Open()
    If appWrd Is Nothing Then
    Set appWrd = Word.Application

    On Error Resume Next
    Application.ScreenUpdating = False
    ActiveDocument.PrintPreview
    ActiveDocument.ClosePrintPreview
    Application.ScreenUpdating = True

    ' On Error Resume Next
    ' Application.ScreenUpdating = False
    ' If ActiveWindow.View.SplitSpecial = wdPaneNone Then
    ' ActiveWindow.ActivePane.View.Type = wdNormalView
    ' Else
    ' Application.ScreenUpdating = True
    ' ActiveWindow.View.Type = wdNormalView
    ' End If
    ' If ActiveWindow.View.SplitSpecial = wdPaneNone Then
    ' ActiveWindow.ActivePane.View.Type = wdPrintView
    ' Else
    ' ActiveWindow.View.Type = wdPrintView
    ' End If
    ' Application.ScreenUpdating = True
    '
    ' On Error Resume Next
    ' ActiveDocument.TablesOfContents(1).UpdatePageNumbe rs
    End If
    End Sub
    Thanks.
    Robie

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: TOC with same page number (WORD 2003)

    Word will have to repaginate the document somehow to update the page numbers - otherwise how would it know which page numbers to use in the TOC? So demanding that the TOC is updated without repaginating the document is contradictory. The pause you suggest building into the print preview gives Word time to repaginate - something you do not want to do. <img src=/S/crazy.gif border=0 alt=crazy width=15 height=15>

    Since the page numbers are updated anyway when the document is printed, why not live with the numbers being inaccurate when the document is opened?

  6. #6
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TOC with same page number (WORD 2003)

    My thoughts exactly. I would love to live with this 'display' problem but the powers that be ...

    Anyway, I think they will have to live with or wait for the re-pagination. Can't have it both ways. I will let them know of the options and then it is up to them.

    Thanks for all your impu Hans.

    Robie.
    Thanks.
    Robie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •