Created
January 27, 2015 00:26
-
-
Save stevehenderson/f7253022087b0254136c to your computer and use it in GitHub Desktop.
A VBA function to wrap a long string with newline characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function wrapString(incomingStr) As String | |
Dim pParts() As String | |
pParts = Split(incomingStr, " ") | |
Dim result As String | |
Dim k As Integer | |
For k = LBound(pParts) To UBound(pParts) | |
result = result & pParts(k) | |
If k Mod 3 = 0 Then | |
result = result & "\n" | |
Else | |
result = result & " " | |
End If | |
Next k | |
wrapString = result | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment