![]() |
|
#1
|
||||
|
||||
![]()
The following will probably do the trick.
Code:
Sub ShrinkCellTextToFit() Dim orng As Range Dim i As Long Const iCol As Integer = 2 'the column to process If Not Selection.Information(wdWithInTable) Then MsgBox "Put the cursor in the table and try again" GoTo lbl_Exit End If For i = 1 To Selection.Tables(1).Rows.Count Set orng = Selection.Tables(1).Cell(i, iCol).Range orng.End = orng.End - 1 Do Until orng.ComputeStatistics(wdStatisticLines) = 1 orng.Font.Shrink Loop Next i lbl_Exit: Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#2
|
|||
|
|||
![]()
Thanks gmayor, almost working
However I did not mention the following relevant notes 1) The cells do have more lines (number not fixed), so it is necessary to change the control alowing to exit the loop. 2) font size in each cell is not the same for all lines. What I want is to avoid the break of originary lines. The final lines of my cell should be those broken by enter, and not those broken by their excessive length. If easier to do, a proxy for this is result is avoiding the breaking of a word, since 99% of problematic lines are composed by a single word. is it possible to get this? Thanks ![]() Marco |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
lyle | Word | 1 | 02-11-2014 03:57 AM |
Asian typography in text boxes - how to avoid lines starting with periods | markpete | Word | 0 | 11-17-2012 01:45 PM |
![]() |
Mayla | Word | 2 | 06-04-2012 07:37 AM |
Break Pivot Into Multiple Tables | Pramalot | Excel | 0 | 05-22-2012 05:21 AM |
![]() |
b0x4it | Word | 4 | 06-14-2011 10:01 PM |