RobbieC
Active Member
- Joined
- Dec 14, 2016
- Messages
- 376
- Office Version
- 2010
- Platform
- Windows
Hi there, I have a problem which has been bugging me for ages...
I have a userform with a multiline text box (limited to 400 chars).
I also have 4 seperate text boxes (not visible to the user on the form)
What I'm trying to do is strip the large multiline-textbox into the 4 smaller text boxes. BUT I want to keep the sentance structure ie. not just chop out the first 100 chars as it could be half way through a word!
So, in essence, I'm looking to look at the first 100 chars, then find the last complete word and copy that series of words into the first smaller textbox
Then do the same with the second smaller text box, but start from where the first one left off... up to smaller textbox number 4
If the user types in a blank line (enter key twice), I don't need that. Not interested in keeping any paragraph formatting - only the actual words that the user types...
I hope I've described this scenario ok.
I tried to use something along this line:
this separates the multiline textbox rows as you type into x number of textboxes for each line. It does work to a degree, but it does it all in real-time and I've noticed that it's prone to errors, such as if you paste a series of words (or a long word) which then move to the next line, or if you delete text back to a previous line
I hope you can understand where I'm coming from. If you can help me out, I'd be most grateful
Thanks
I have a userform with a multiline text box (limited to 400 chars).
I also have 4 seperate text boxes (not visible to the user on the form)
What I'm trying to do is strip the large multiline-textbox into the 4 smaller text boxes. BUT I want to keep the sentance structure ie. not just chop out the first 100 chars as it could be half way through a word!
So, in essence, I'm looking to look at the first 100 chars, then find the last complete word and copy that series of words into the first smaller textbox
Then do the same with the second smaller text box, but start from where the first one left off... up to smaller textbox number 4
If the user types in a blank line (enter key twice), I don't need that. Not interested in keeping any paragraph formatting - only the actual words that the user types...
I hope I've described this scenario ok.
I tried to use something along this line:
Code:
Dim strMultiLineData, x As Integer
strMultiLineData = Split(Me.description, vbCrLf)
For x = LBound(strMultiLineData) To UBound(strMultiLineData)
Me.Controls("TextBox" & x + 1) = strMultiLineData(x)
'Debug.Print strMultiLineData(x) & " --- " & x
Next x
I hope you can understand where I'm coming from. If you can help me out, I'd be most grateful
Thanks