- Home
·
- String Manipulation
·
- I have a text box that I need to print directly from VB. Problem is there is no Word Wrap functio
I have a text box that I need to print directly from VB. Problem is there is no Word Wrap functio
I have a text box that I need to print directly from VB. Problem is there is no "Word Wrap" functionality. Other posts and Knowledge Base
Rate I have a text box that I need to print directly from VB. Problem is there is no Word Wrap functio
(1(1 Vote))
'TempMsg is the string that I build the printable message
'SelStart is the SelStart property of the text box - assigning it directly did not work
'75 is the number of characters that I needed on a line.
Dim TempMsg As String
Dim SelectLength, SelectStart, Trapper As Integer
If Len(Me.txtMsg.Text) < 75 Then
TempMsg = Me.txtMsg.Text
Else
SelectStart = 0
SelectLength = 75
Do While Len(Me.txtMsg.Text) > 0
Clipboard.Clear
If Len(Me.txtMsg.Text) < 75 Then
Me.txtMsg.SelLength = Len(Me.txtMsg.Text)
Else
Me.txtMsg.SelLength = 75
End If
Trapper = InStrRev(Me.txtMsg.SelText, Chr(32), -1, vbBinaryCompare)
If Trapper = 0 Then
Me.txtMsg.SelLength = Len(Me.txtMsg.Text)
Else
Me.txtMsg.SelLength = Trapper
End If
TempMsg = TempMsg & Me.txtMsg.SelText & Chr(13)
MsgBox TempMsg
Me.txtMsg.SelText = ""
Me.txtMsg.SelStart = 0
Loop
End If
I have a text box that I need to print directly from VB. Problem is there is no Word Wrap functio Comments
No comments yet — be the first to post one!
Post a Comment