View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default use VBA to tell if all the text in a TextBox or TextFrame can be displayed

Brian,
Not great, but maybe this can get you started:

'Assumes 2 textboxes on a WS
Private Sub CommandButton3_Click()

'Add a lot of text to TextBox1
TextBox1.Text = "Add a lot of text to TextBox1" & vbNewLine & "Add a lot of
text to TextBox1" & vbNewLine & "Add a lot of text to TextBox1" & vbNewLine
& "Add a lot of text to TextBox1"

With TextBox2
.AutoSize = False
.Text = TextBox1.Text
.AutoSize = True
If .Height TextBox1.Height Then
MsgBox "Text does not fit"
End If
End With

End Sub

NickHK

wrote in message
ups.com...
Is there a way to use VBA to determine if a TextBox or TextFrame
object is sized large enough to display all the text it contains?

Thanks,

Brian Murphy