Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
TextBox question
I need a TextBox which allows for multiple lines of text. Is there any way
to restrict the TextBox to only allow 3 lines of text? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
TextBox question
Hello Patrick, There really isn't any good way to restrict the number of lines in multi-line text box. The font size, font style, box size, and case al effect the wrap around feature which can't be detected in an event lik pressing the enter key. If there were a window handle to the text bo this could accomplished using API calls from VBA. Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=55918 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
TextBox question
Patrick,
You can use a RichTextBox instead, as it has more properties to play with. Private Sub RichTextBox1_KeyDown(KeyCode As Integer, ByVal Shift As Integer) With RichTextBox1 If .GetLineFromChar(Len(.Text)) MaxNumberOfLines-1 Then MsgBox "That's enough" KeyCode = 0 End If End With End Sub NickHK "Patrick Simonds" wrote in message ... I need a TextBox which allows for multiple lines of text. Is there any way to restrict the TextBox to only allow 3 lines of text? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
TextBox Question | Excel Discussion (Misc queries) | |||
Textbox Question | Excel Programming | |||
Textbox Question | Excel Programming | |||
Textbox question? | Excel Discussion (Misc queries) | |||
Textbox question 2 | Excel Programming |