Answers for "vba string remove newline"

VBA
0

vba remove line breaks

' Removes line breaks and spaces at the end of text
Function RemoveLastLineBreaks(ByRef pText As String) As String
    Dim textLng As Long
    RemoveLastLineBreaks = pText
    textLng = Len(RemoveLastLineBreaks)
    While (textLng > 0 And (Mid(RemoveLastLineBreaks, textLng) = vbCr _
            Or Mid(RemoveLastLineBreaks, textLng) = vbLf) _
            Or Mid(RemoveLastLineBreaks, textLng) = " ")
        RemoveLastLineBreaks = Mid(RemoveLastLineBreaks, 1, textLng - 1)
        textLng = Len(RemoveLastLineBreaks)
    Wend
End Function
Posted by: Guest on February-12-2021

Code answers related to "vba string remove newline"

Code answers related to "VBA"

Browse Popular Code Answers by Language