Varying font size dynamically

  • Thread starter Thread starter Guy Scharf
  • Start date Start date
G

Guy Scharf

I have a need to print a text field in a fixed space. If the text in
the field is long, I need to reduce the font size so that it will all
fit.

How might I accomplish that?

Thanks.

Guy
 
Guy said:
I have a need to print a text field in a fixed space. If the text in
the field is long, I need to reduce the font size so that it will all
fit.


Very tricky problem. Fortunately Stephen Lebans has worked
out the really complex part at
http://www.lebans.com/textwidth-height.htm

Once you download and import the module, you can use code
something like:

For FS = 12 To 4 Step -1
If fTextHeight(Me.thetextbox) < Me.thetextbox.Height _
And fTextWidth(Me.thetextbox) < Me.thetextbox.Width _
Then Exit For
Next FS
Me.thetextbox.FontSize = FS
 
Marsh,

Thank you. I've got that working as desired, with a few minor changes.

Guy
 
Back
Top