Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox Question Jim Excel Discussion (Misc queries) 4 July 11th 08 10:41 PM
Textbox Question Greg B[_6_] Excel Programming 2 November 5th 05 05:03 PM
Textbox Question Patrick Simonds Excel Programming 2 September 29th 05 02:12 PM
Textbox question? Greg B Excel Discussion (Misc queries) 2 June 2nd 05 03:56 PM
Textbox question 2 Rich Cooper Excel Programming 5 June 14th 04 08:51 PM


All times are GMT +1. The time now is 05:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"