Convert string
The first 27 or so characters are considered control characters (lf and cr
are characters 10 and 13 respectively). Generally fonts don't produce a
displayable character for these. Excel pretty consistently displays the
Chr(13) as an excess character when wrap text is applied. For example, the
Character Map applet doesn't display characters before 33 (32 is a space) for
any font.
So using VbLF is an excellent suggestion. VBNewline produces the same as
vbCrLf in windows.
--
Regards,
Tom Ogilvy
"Ben McBen" wrote:
Dos that depend on font family?
"vbapro" wrote:
vbCrLf gives extra unnecessary CR symbol which can be displayed as a square,
that is why nicer to use vbLf
"Ben McBen" wrote:
Something like:
Public Function ChopAndTrim(strInput As String, intChopLen As Integer) As
String
Dim strArr() As String
Dim strTmp As String
Dim strOut As String
Dim i As Long
strArr = Split(strInput, " ")
For i = LBound(strArr) To UBound(strArr)
If Len(strTmp) + Len(strArr(i)) intChopLen Then
strOut = strOut & strTmp & vbCrLf
strTmp = strArr(i) & "_"
Else
strTmp = strTmp & strArr(i) & "_"
End If
If i = UBound(strArr) Then
strOut = strOut & strArr(i)
End If
Next i
ChopAndTrim = strOut
End Function
You will need to set formatting to wrap text....
"Excel ESG" wrote:
Hello,
I have a string wich I want to convert.
All spaces should be replaced by an underscore,
and an (alt-enter) should be inserted after an underscore so that the string
is wrapped to a max length of 13 characters
e.g "Thanks very much in advance" should result in
Thanks_very_(Alt-Enter)
much_in_(Alt-Enter)
advance
Someone told me it should be possible with an UDF,
but I have no experience with that
|