To check for a carriage return match the character to vbCr, however if /n equates to new line it could actually be two consecutive characters in the string vbCr followed by vbLf
Again not the only way but is simple, easy to read or extend to other characters
Select Case mycharacter
Case vbCr
'code here if return (13)
Case vbLf
'code here if linefeed (10)
Case "A","a"
'for example code here if an A
Case Else
'code for other characters
End Select
Dim Occ As Integer
Public Function ScanLine(s)
Dim LengthofLine
Dim checking
Dim theLine
Dim Tmp
Occ = 1
Tmp = 0
theLine = s
LengthofLine = Len(theLine)
For x = 1 To LengthofLine
checking = Mid(theLine, x, 1)
If Tmp >
85
Code:
Then
Occ = Occ + 1
Tmp = 0
End If
If checking = Chr$(13) Then
Occ = Occ + 1
Tmp = 0
Else
Tmp = Tmp + 1
End If
Next x
End Function
You have to adapt the number in red (number of char per lines)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.