Reputation: 15
I am trying to automatically shrink the text in a textbox to a proper size, on overflow.
There are similar functions for textboxes in PowerPoint and MS Publisher, but it is not in MS Word. I have searched the web and there are a lot of discussions on how to wrap text or to shrink the text to fit the width of a textbox.
I want the text box to wrap multiple lines and shrink the text size only when it runs out of space in the text box.
Upvotes: 0
Views: 3001
Reputation: 13515
Word has no built-in functionality for that. Word table cells have a 'fit text' option, but that forces the content to all fit on one line in the cell rather than condensing it just enough to fit the vertical height.
I wrote a macro for condensing text to eliminate minor line-wraps, which you can get from: https://www.msofficeforums.com/word-vba/40613-how-resize-paragraph-range-include-single-line.html. That macro could be adapted to do something similar for just a selected/nominated textbox. If you require more condensing than to eliminate just a short last line, further mods would be needed. For example, you might incorporate something along the lines of:
With Selection.ShapeRange.TextFrame
Do While .Overflowing = True
.TextRange.Font.Size = .TextRange.Font.Size - 0.5
Loop
End With
Upvotes: 1