PDA

View Full Version : Solved: textbox-linecount and individual lines?



clvestin
01-14-2006, 05:54 PM
I have a multiline textbox. Entries are made(short notes) seperated into lines by a Shift+Enter. I can read the number of lines in the textbox by:
userform1.textbox5.linecount of course.
Is anyone familiar with a method of reading each line ie:

Userform1.Textbox5.Line4.Text??? (My fantasy VBA code here)

Zack Barresse
01-14-2006, 05:59 PM
No, you can't do it that way. You would have to check for the return character, which I can't remember off the top of my head if that is Chr(10) or Chr(13).. You can use a series of Substitute functions to obtain that data though. Depending on how you wanted to use it, I would do it different ways. So more explanation would be better.

I'm wondering why the multiple lines with the Shift + Enter though. :?

mdmackillop
01-14-2006, 06:58 PM
Private Sub CommandButton1_Click()
TextBox1.SetFocus
tmp = TextBox5.LineCount
For i = 0 To tmp - 1
MsgBox Split(TextBox1, Chr(13))(i)
Next
End Sub

clvestin
01-14-2006, 07:27 PM
Yikes--Where do you find this stuff?? Excellent-Thank You
Just as expl to your question--I'm using a large multiline textbox for quick and dirty entry of short notes(eg Equipment #-Problem)..somewhat like a bulleted list. I want to use only the one form(two would confuse them) and gather entries as easily as possible. These entries, among others, are placed on another report sheet.