Detecting text overflow of a textbox

J

jimthompson5802

I am using VBA to fill a pre-positioned textbox on a diagram. Depending on
the amount of data, the text may overflow past the bottom of the textbox.
I'd like to do two things:
1) Detect when the text overflows past the bottom of the textbox in VBA
2) Determine how large the textbox has to be to contain the text. In my
case, the width of the box cannot change. I only need to change the height
property. How do I determine the height value to contain the text?

Jim T
 
P

Paul Herber

I am using VBA to fill a pre-positioned textbox on a diagram. Depending on
the amount of data, the text may overflow past the bottom of the textbox.
I'd like to do two things:
1) Detect when the text overflows past the bottom of the textbox in VBA
2) Determine how large the textbox has to be to contain the text. In my
case, the width of the box cannot change. I only need to change the height
property. How do I determine the height value to contain the text?

You could just set the height of the box with a formula so it resizes automatically with
the text:
In the shape's shapesheet set the Height formula to:
=GUARD(MAX(TEXTHEIGHT(TheText, Width)+1mm, 10mm))

That will set the box height to the (height of the text)+1mm, but with a minimum height of
10mm.
 

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