View Single Post
 
Old 03-14-2018, 03:55 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Heifa,

What you're asking isn't possible without a macro, but a macro-driven solution can be seamless. If you add the following macro to your mailmerge main document (which you'll need to save in the docm format), and use a single-cell table to contain the address details, clicking on the 'Edit Individual Documents' button will intercept the merge, finishing it and producing an output document with any long lines compressed to fit the space available. With a few minor modifications, the macro could be made to send the output to the printer instead of leaving you with a new document.
Code:
Sub MailMergeToDoc()
Application.ScreenUpdating = False
Dim Tbl As Table, Cll As Cell, Par As Paragraph, sCllWdth As Single, sParWdth As Single
With ActiveDocument
  With .Tables(1)
    For Each Cll In .Range.Cells
      Cll.WordWrap = False
    Next
    With .Cell(1, 1)
      sCllWdth = .Width - .LeftPadding - .RightPadding
    End With
  End With
  .MailMerge.Execute
End With
With ActiveDocument
  For Each Tbl In .Tables
    For Each Cll In Tbl.Range.Cells
      If Len(Cll.Range) > 2 Then
        For Each Par In Cll.Range.Paragraphs
          With Par.Range
            sParWdth = .Characters.Last.Previous.Information(wdHorizontalPositionRelativeToPage)
            sParWdth = sParWdth - .Characters.First.Information(wdHorizontalPositionRelativeToPage)
            If sParWdth + Par.LeftIndent > sCllWdth Then .FitTextWidth = sCllWdth - Par.LeftIndent
            If .Characters.Last.Previous.Information(wdVerticalPositionRelativeToPage) <> _
              .Characters.First.Information(wdVerticalPositionRelativeToPage) Then
              .FitTextWidth = sCllWdth - Par.LeftIndent
            End If
          End With
        Next
      End If
    Next
  Next
End With
Application.ScreenUpdating = True
End Sub
Note 1: The code assumes the table used to hold the addressing is the only table in the document; changes might be needed if there are other tables.

Note 2: You shouldn't use the mailerge 'addressblock' field for this - insert the individual mergefields instead, with paragraph breaks separating the various address lines.

For the single-cell table, to set the fixed:
• row height, use Table Tools>Layout>Properties>Row>Specify Height>Exactly.
• column width, first uncheck the 'automatically resize to fit contents' option under Table Tools>Layout>Properties>Table>Options. Then set the preferred column width under Table Tools>Layout>Properties>Columns.
You might also want to set the cell margins to 0 all round and format the cell paragraphs with 0 before/after spacing.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote