auto change font szie to make content fit the cell in word table?

J

JerryLee80

I have a fixed size cell in word table, so i should program to automatically
change font size of contents in that cell, but how?
I have tried to find some helpful infomation , but nothing i found. Anyone
can help me?
 
D

Doug Robbins - Word MVP

Use the following:

Dim flag As Boolean, arange As Range, i, j, k

Set arange = Selection.Cells(1).Range
k = arange.Font.Size
flag = False
Do While flag = False
arange.End = arange.End - 1
arange.Select
i = arange.Information(wdVerticalPositionRelativeToPage)
arange.Collapse wdCollapseEnd
j = arange.Information(wdVerticalPositionRelativeToPage)
If j > i Then
Set arange = Selection.Cells(1).Range
arange.Font.Size = k - 0.5
k = arange.Font.Size
Else
flag = True
End If
Loop


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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