Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

LinkBack Thread Tools Display Modes
Old 03-14-2018, 06:40 AM
HeiFa HeiFa is offline Windows 10 Office 2016
Join Date: Mar 2018
Posts: 1
HeiFa is on a distinguished road
Default Change font-size automatically in addressfield for only the line for name

Hello everyone.

I want to update a template, where i have an addressfield.

Into this addressfield a name is inserted on the name line. It's the first line on the field.

If this name is to long, i want the font-size to adjust just so much, that the name fits one line.

This needs to fit the normal letter window envelopes, so not much space to use a to small / big font or many line breaks.

Names may vary in length alot, so if the name is too small, i'd like to avoid stretching the words over one line or having them to big all of a sudden.

I know, i can do some stuff with VBA macros, but if possible, it should be doable without them.

I found something on the net, explaining that tablecells could have this kind of behaviour, but not sure if it is applicable.

My question now is:

Can i do something like this without macros in Word 2016?

If not, how could i find a solution or explanation for what i'm looking for?
If possible, i'd like to understand what i'm supposed to to, but i have no knowledge of VBA and this stuff whatsoever.

I'd gladly take any hint, suggestion and help, you could offer me.

Please ask, if i did not explain anything necessary or when i was unclear about something.

Thank you in advance.
Reply With Quote
Old 03-14-2018, 03:55 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,191
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

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.
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
    With .Cell(1, 1)
      sCllWdth = .Width
      With .Range.Paragraphs(1)
        sCllWdth = sCllWdth - .LeftIndent - .RightIndent
      End With
    End With
  End With
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 > sCllWdth Then .FitTextWidth = sCllWdth
            If .Characters.Last.Previous.Information(wdVerticalPositionRelativeToPage) <> _
              .Characters.First.Information(wdVerticalPositionRelativeToPage) Then
              .FitTextWidth = sCllWdth
            End If
          End With
      End If
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.
Paul Edstein
[MS MVP - Word]
Reply With Quote

Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping Macro to Change Font, Font Size, and Give Heading 1 WH7262 Word VBA 1 08-26-2014 03:46 PM
Unable to change font size Andoheb Outlook 1 11-23-2012 07:24 PM
how change size font to inches size kkepo Word 4 08-28-2012 08:53 PM
Change font & point size? 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

All times are GMT -7. The time now is 08:16 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc. is not affiliated with Microsoft