Andrea: We usually use a table cell that is set to EXACTLY X" high. Then, no
matter how much they type, you can only see what you intended. This won't be
good if you're processing the data afterward, tho.
************
Anne Troy
www.OfficeArticles.com
> OK, here is my question....is there code I can use that allows me to type
> text up to 3 lines versus limiting how much I type on 3 lines by character
[quoted text clipped - 23 lines]
> Any help is appreciated!
> Andrea :)
Andrea - 11 Aug 2005 00:40 GMT
Hi Anne, thank you for the suggestion, it is a very creative work around. :)
I am still looking for a 'fixed' solution because what if they do type over,
then when they go to print they are going to be upset that not all of their
text did not print..... I tried a similar solution to what you recomemnded
yesterday and that was their latest complaint.
Thanks again...
Andrea
> Andrea: We usually use a table cell that is set to EXACTLY X" high. Then, no
> matter how much they type, you can only see what you intended. This won't be
[quoted text clipped - 30 lines]
> > Any help is appreciated!
> > Andrea :)
Anne Troy - 11 Aug 2005 01:39 GMT
Sorry, Andrea. The other answer is code, which I don't do personally.
However, even with code, unless the font is fixed-pitch, I don't see this
being easy to "force" to end at "x", you know?
My apologies... I've just realized you're talking about a textbox, and not
a text form field. Using a textbox smack-dab in the middle of a document is
not a good idea anyway. Perhaps you could tell us what kind of template
you're creating, and why you're using a textbox instead of form fields (see
http://www.officearticles.com/word/create_a_fill-in_form_in_microsoft_word.htm),
maybe we can be more helpful.
************
Anne Troy
www.OfficeArticles.com
> Hi Anne, thank you for the suggestion, it is a very creative work around.
> :)
[quoted text clipped - 50 lines]
>> > Any help is appreciated!
>> > Andrea :)
>OK, here is my question....is there code I can use that allows me to type
>text up to 3 lines versus limiting how much I type on 3 lines by character
[quoted text clipped - 21 lines]
>Any help is appreciated!
>Andrea :)
Forget about the MaxLength -- as you already know, it's useless.
Instead, include this event procedure (change the default name
"TextBox1" to the name of your textbox throughout):
Private Sub TextBox1_Change()
With TextBox1
If .LineCount > 3 Then
.Text = Left(.Text, Len(.Text) - 1)
MsgBox "No more text, please!"
End If
End With
End Sub
This procedure runs on every keystroke that's typed in the textbox. As
long as the line count is 3 or less, it just exits. If the typed
character would cause a fourth line, the body of the If statement
"eats" the character.
The MsgBox is optional -- if you leave it out, the user just can't
type anything past the end of the third line (actually, they can type
lots of spaces there, but they won't appear).
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Jay Freedman - 11 Aug 2005 14:56 GMT
>> OK, here is my question....is there code I can use that allows me to
>> type text up to 3 lines versus limiting how much I type on 3 lines
[quoted text clipped - 49 lines]
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
I realized after I posted that code that it doesn't properly handle what
happens if the user pastes text into the box. If the pasted text would make
the contents longer than 3 lines plus 1 character, only the last character
would be removed and the contents would still be more than 3 lines.
This version fixes that:
Private Sub TextBox1_Change()
With TextBox1
Do While .LineCount > 3
.Text = Left(.Text, Len(.Text) - 1)
Loop
End With
End Sub

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Andrea - 11 Aug 2005 18:28 GMT
Great...I am going to give this a try on Monday Jay. I will let you know how
it works out.
Thanks so much!
Andrea
> >> OK, here is my question....is there code I can use that allows me to
> >> type text up to 3 lines versus limiting how much I type on 3 lines
[quoted text clipped - 64 lines]
> End With
> End Sub
Andrea - 26 Aug 2005 01:39 GMT
Hi Jay, your code below worked perfectly.
Thanks so much!
Andrea
> >> OK, here is my question....is there code I can use that allows me to
> >> type text up to 3 lines versus limiting how much I type on 3 lines
[quoted text clipped - 64 lines]
> End With
> End Sub