Height of the text in cell

P

Phelicks

Hi folks.
I need to write a macros that reduces size of text in table when it
begin to resize in case of long string of text inserted ?
 
H

Helmut Weber

Hi,

like this, but I wonder, whether it's a good idea,
to reduce font size until the text doesn't occupy
more then the given number of lines.

Sub Test733()
Dim LinesAllowed As Long
LinesAllowed = 2
selection.Cells(1).Range.Text = String(30, "m")
selection.Cells(1).Select
selection.End = selection.End - 1
With selection.Range
While .ComputeStatistics(wdStatisticLines) > LinesAllowed
.Font.Size = .Font.Size - 1
Wend
End With
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top