Not without a bunch of GDI API work. The AutoSizeTextBox solution on my site
shows you how.
A far simpler solution, that is almost as accurate would be to use
code/logic like:
Assumes ListBox control named lbHeight
Assumes TestBox control named Text11
Assumes CommandButton named CmdSize
Enter a desired number of rows value in Text11 and then click on the
CommandButton.
Private Sub cmdSize_Click()
On Error GoTo Err_cmdSize_Click
Dim x As Integer
' convert Twips to TwipsPerPoint
x = 1440 / 72
' multiply font height x TwipsPerPoint
x = (x * Me.lbHeight.FontSize) * Val(Me.Text11.Value)
' Vertical space(margin)Access leaves between rows when more than 1 row
x = x + (Val(Me.Text11.Value) - 1) * 50
' Resize ListBox control to display Number Of Rows as expressed In Text1
' Access leaves around 100 Twips as a margin at the top of the ListBox
control
Me.lbHeight.Height = x + 100
Exit_cmdSize_Click:
Exit Sub
Err_cmdSize_Click:
MsgBox Err.Description
Resume Exit_cmdSize_Click
End Sub
--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.