![]() |
|
![]() |
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
![]()
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 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] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
WH7262 | Word VBA | 1 | 08-26-2014 03:46 PM |
Unable to change font size | Andoheb | Outlook | 1 | 11-23-2012 07:24 PM |
![]() |
kkepo | Word | 4 | 08-28-2012 08:53 PM |
![]() |
markg2 | Outlook | 2 | 06-09-2010 03:23 PM |
Can't change font type or size | sideways | Word | 2 | 11-01-2009 09:57 AM |