Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-15-2021, 03:00 PM
macropod's Avatar
macropod macropod is offline Select and change font size of words by number of characters Windows 10 Select and change font size of words by number of characters Office 2016
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


Such labels are usually generated via a mailmerge, in which case, see: https://www.msofficeforums.com/125792-post2.html

Otherwise, try the following macro:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Tbl As Table, Cll As Cell, Par As Paragraph, sCllWdth As Single, sParWdth As Single
With ActiveDocument
  For Each Tbl In .Tables
    With Tbl
      With .Cell(1, 1)
        sCllWdth = .Width - .LeftPadding - .RightPadding
      End With
      For Each Cll In .Range.Cells
        With Cll
          .WordWrap = False
          If Len(.Range) > 2 Then
            For Each Par In .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
        End With
      Next
    End With
  Next
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Select and change font size of words by number of characters VBA - Word how to globally change the font and font size in footnotes thomasoj Word VBA 3 01-15-2020 06:26 AM
VBA - change font and font size for Word footnote thomasoj Word VBA 1 01-15-2020 02:37 AM
Select and change font size of words by number of characters Looping Macro to Change Font, Font Size, and Give Heading 1 WH7262 Word VBA 1 08-26-2014 03:46 PM
Select and change font size of words by number of characters how change size font to inches size kkepo Word 4 08-28-2012 08:53 PM
Select and change font size of words by number of characters Highlight the first X number of characters 14spar15 Word 1 11-13-2011 11:17 PM

Other Forums: Access Forums

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


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