Microsoft Office Forums Mail merged document and page numbers for table of contents

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-31-2016, 10:44 AM
jab40 jab40 is offline Mail merged document and page numbers for table of contents Windows 7 32bit Mail merged document and page numbers for table of contents Office 2010 32bit
Novice
Mail merged document and page numbers for table of contents
 
Join Date: Jul 2011
Posts: 15
jab40 is on a distinguished road
Default Mail merged document and page numbers for table of contents

Hi there



I hope someone can help me?

I needed the same table repeated about 150 times with just one heading changed (in brief, I'm a medical student, and need a table that says description, cause, symptoms, treatment etc for every condition I need to learn).

I did a 'letters' mail merge to create a document that had this and it worked perfectly -- almost: I do indeed have the same table 150 times with only the condition name changed.

However, I added a table of contents, and I see that every page, from the first to the last, is 'page 1', which makes sense, given that this is the intended use of the letters mail merge option.

Is there a way to change this so that it now sees my document not as many individual documents, but as one long document, so the page numbers act as normal?

Thanks for your help.
JB
Reply With Quote
  #2  
Old 03-31-2016, 03:02 PM
macropod's Avatar
macropod macropod is offline Mail merged document and page numbers for table of contents Windows 7 64bit Mail merged document and page numbers for table of contents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,525
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

You can fix that with a Find/Replace, where:
Find = ^12
Replace = ^12
Although the find & replace expressions are the same, this will convert all the Section breaks inserted by the merge into page breaks.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 03-31-2016, 11:56 PM
jab40 jab40 is offline Mail merged document and page numbers for table of contents Windows 7 32bit Mail merged document and page numbers for table of contents Office 2010 32bit
Novice
Mail merged document and page numbers for table of contents
 
Join Date: Jul 2011
Posts: 15
jab40 is on a distinguished road
Default

Thanks for your reply. Sadly, I seem to be having 2 problems with this:

1. The find and replace seems to just be removing the breaks, so the tables are now not on separate pages but joined, following on one from the next.

2. Replace all does not work, so I have to click Replace 100s of times to work it.

Is this a problem with it being on Word for Mac?

BW
JB
Reply With Quote
  #4  
Old 04-01-2016, 12:07 AM
macropod's Avatar
macropod macropod is offline Mail merged document and page numbers for table of contents Windows 7 64bit Mail merged document and page numbers for table of contents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,525
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Your profile indicates you're using Office 2010, not Word for Mac! Regardless, the Find/Replace won't of itself cause the tables to join. If that's happening, it suggests your tables have the 'around' wrap format. Setting the wrap format to 'None' should resolve that issue.

As for 'Replace all' not working, it does on a PC and I see no reason why it shouldn't on a Mac. Changing the table wrap format may resolve that issue too.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 04-05-2016, 02:35 AM
jab40 jab40 is offline Mail merged document and page numbers for table of contents Windows 7 32bit Mail merged document and page numbers for table of contents Office 2010 32bit
Novice
Mail merged document and page numbers for table of contents
 
Join Date: Jul 2011
Posts: 15
jab40 is on a distinguished road
Default

Yes, sorry, I have changed OS since last posting!

I've given what you said a try, but sadly still no success =( . Would I be able to email it over to you and see if you can get it to work -- would that be okay?

BW
JB
Reply With Quote
  #6  
Old 04-05-2016, 04:00 AM
macropod's Avatar
macropod macropod is offline Mail merged document and page numbers for table of contents Windows 7 64bit Mail merged document and page numbers for table of contents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,525
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Another option you might consider for the numbering is to use a SECTION field instead of a PAGE field for the numbering. It will provide the same results as you want from a PAGE field if each Section consists of a single page.

If you want someone to take a look at your mailmerge output document, you could attach it to a post, via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #7  
Old 04-05-2016, 04:34 AM
jab40 jab40 is offline Mail merged document and page numbers for table of contents Windows 7 32bit Mail merged document and page numbers for table of contents Office 2010 32bit
Novice
Mail merged document and page numbers for table of contents
 
Join Date: Jul 2011
Posts: 15
jab40 is on a distinguished road
Default

Many thanks. Here is the document, if anyone has any success I'd be massively grateful.

EDIT: The file was too big, I'll try to reduce it.

BW
JB
Reply With Quote
  #8  
Old 04-06-2016, 05:46 AM
macropod's Avatar
macropod macropod is offline Mail merged document and page numbers for table of contents Windows 7 64bit Mail merged document and page numbers for table of contents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,525
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

There's still no attachment, but you might try running the following macro on your mailmerge output document:
Code:
Sub Reformat()
Application.ScreenUpdating = False
Dim HdFt As HeaderFooter, Rng As Range
With ActiveDocument
  If .Sections.Count > 1 Then
    For Each HdFt In .Sections(.Sections.Count).Headers
      If HdFt.Exists Then
        HdFt.Range.FormattedText = .Sections(1).Headers(HdFt.Index).Range.FormattedText
        HdFt.Range.Characters.Last.Delete
      End If
    Next
    For Each HdFt In .Sections(.Sections.Count).Footers
      If HdFt.Exists Then
        HdFt.Range.FormattedText = .Sections(1).Footers(HdFt.Index).Range.FormattedText
        HdFt.Range.Characters.Last.Delete
      End If
    Next
  End If
  Do While .Sections.Count > 1
    Set Rng = .Sections(1).Range.Characters.Last
    Rng.Delete
    Rng.InsertBreak Type:=wdPageBreak
    DoEvents
  Loop
  .Range.Characters.Last.Delete
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #9  
Old 04-07-2016, 12:04 AM
jab40 jab40 is offline Mail merged document and page numbers for table of contents Windows 7 32bit Mail merged document and page numbers for table of contents Office 2010 32bit
Novice
Mail merged document and page numbers for table of contents
 
Join Date: Jul 2011
Posts: 15
jab40 is on a distinguished road
Default

Thanks for your reply. Unfortunately it seems my document is too big to post here.

I've tried the macro, but it says

"Run-time error '5937': Cannot copy content between these two ranges"

When I debug it, it highlights this line:

HdFt.Range.FormattedText = .Sections(1).Headers(HdFt.Index).Range.FormattedTe xt

Any thoughts?
Reply With Quote
  #10  
Old 04-07-2016, 01:03 AM
macropod's Avatar
macropod macropod is offline Mail merged document and page numbers for table of contents Windows 7 64bit Mail merged document and page numbers for table of contents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,525
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Try:
Code:
Sub Reformat()
Application.ScreenUpdating = False
Dim HdFt As HeaderFooter, Rng As Range
With ActiveDocument
  If .Sections.Count > 1 Then
    For Each HdFt In .Sections(.Sections.Count).Headers
      If HdFt.Exists Then
        If Len(.Sections(1).Headers(HdFt.Index).Range) > 1 Then
          HdFt.Range.FormattedText = .Sections(1).Headers(HdFt.Index).Range.FormattedText
          HdFt.Range.Characters.Last.Delete
        End If
      End If
    Next
    For Each HdFt In .Sections(.Sections.Count).Footers
      If HdFt.Exists Then
        If Len(.Sections(1).Footers(HdFt.Index).Range) > 1 Then
          HdFt.Range.FormattedText = .Sections(1).Footers(HdFt.Index).Range.FormattedText
          HdFt.Range.Characters.Last.Delete
        End If
      End If
    Next
  End If
  Do While .Sections.Count > 1
    Set Rng = .Sections(1).Range.Characters.Last
    Rng.Delete
    Rng.InsertBreak Type:=wdPageBreak
    DoEvents
  Loop
  .Range.Characters.Last.Delete
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #11  
Old 04-07-2016, 01:07 AM
jab40 jab40 is offline Mail merged document and page numbers for table of contents Windows 7 32bit Mail merged document and page numbers for table of contents Office 2010 32bit
Novice
Mail merged document and page numbers for table of contents
 
Join Date: Jul 2011
Posts: 15
jab40 is on a distinguished road
Default

It got further this time!

Run-time error 4605:

This method or property is not available because the current selection is outside of a block-level XML element.

Debug highlights:

Rng.InsertBreak Type:=wdPageBreak
Reply With Quote
  #12  
Old 04-07-2016, 01:47 AM
macropod's Avatar
macropod macropod is offline Mail merged document and page numbers for table of contents Windows 7 64bit Mail merged document and page numbers for table of contents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,525
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Without seeing whatever part of your document the code is failing at, I'm not in a position to address whatever the issue is - it's not something that I've encountered in my test files.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #13  
Old 04-07-2016, 01:58 AM
jab40 jab40 is offline Mail merged document and page numbers for table of contents Windows 7 32bit Mail merged document and page numbers for table of contents Office 2010 32bit
Novice
Mail merged document and page numbers for table of contents
 
Join Date: Jul 2011
Posts: 15
jab40 is on a distinguished road
Default

Can I email it to you? Even splitting it in half it is too big to upload here.
Reply With Quote
  #14  
Old 04-07-2016, 02:31 AM
macropod's Avatar
macropod macropod is offline Mail merged document and page numbers for table of contents Windows 7 64bit Mail merged document and page numbers for table of contents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,525
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

I only need a few pages, including the ones either side of the problem. Identifying them requires nothing more than finding the first Section break remaining in the document after the macro crashes.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #15  
Old 04-07-2016, 02:51 AM
jab40 jab40 is offline Mail merged document and page numbers for table of contents Windows 7 32bit Mail merged document and page numbers for table of contents Office 2010 32bit
Novice
Mail merged document and page numbers for table of contents
 
Join Date: Jul 2011
Posts: 15
jab40 is on a distinguished road
Default

Okay, here you go.

J
Attached Files
File Type: docx wo endo.docx (336.0 KB, 4 views)
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail merged document and page numbers for table of contents Cannot Update Page Numbers Only on Table of Contents CrossReach Word 8 03-09-2016 01:18 PM
Mail merged document and page numbers for table of contents Table of Contents - page numbers not aligned to the right in longer headings krneki Word 3 08-17-2015 08:34 AM
Mail merged document and page numbers for table of contents Align Mail Merged Numbers to the Decimal Point HangMan Mail Merge 1 12-11-2013 02:32 PM
Mail merged document and page numbers for table of contents Page Numbers in Table of Contents MerRob54 Word 6 01-28-2013 03:37 AM
Mail merged document and page numbers for table of contents decimal numbers not appearing properly in merged document paulys Mail Merge 2 08-06-2012 08:15 AM


All times are GMT -7. The time now is 10:10 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft