ConvertMultiLine2 + 6

Convert text blocks (by converting line separators from any separator to any).
This can help show and store text blocks (multi-line strings) in any form, merely created for Textbox, cell in Excel, and line
Comes with additional quick functions of ...
Cell2Line, Line2Cell, Line2Textbox, Textbox2Line, Cell2Textbox, Textbox2Cell
Where:
' Cell: Line-separator is vbLf, To show a multi-line text in a cell for user, it separates multi-line text with vbLf
' TextBox : Line Separator is vbCrLf, , (In VBA) separates multi-line with vbCrLf
' Line: Line separator is 'Sepa'

Function ConvertMultiLine2(TextFrom, Optional Sepa1 = "|", Optional Sepa2 = vbCrLf)
 Rett = ""
 For Each TeT in Split(TextFrom, Sepa1)
  DoEvents
  If Rett > "" Then Rett = Rett & Sepa2
  Rett = Rett & TeT
 Next i
 ConvertMultiLine2 = Rett
End Function

Function Cell2Line(CellText, Optional LineSepa = "|")
 Cell2Line = ConvertMultiLine2(CellText, vbLf, LineSepa)
End Function
Function Line2Cell(LineText, Optional LineSepa = "|")
 Line2Cell = ConvertMultiLine2(LineText, LineSepa, vbLf)
End Function
Function Line2Textbox(LineText, Optional LineSepa = "|")
 Line2Textbox ConvertMultiLine2(LineText, LineSepa)
End Function
Function Textbox2Line(TextboxText, Optional LineSepa = "|")
 Textbox2Line = ConvertMultiLine2(TextboxText, vbCrLf, LineSepa)
End Function
Function Textbox2Cell(TextboxText)
 Textbox2Cell = ConvertMultiLine2(TextboxText, vbCrLf, vbLf)
End Function
Function Cell2Textbox(CellText)
 Cell2Textbox = ConvertMultiLine2(CellText, vbLf, vbCrLf)
End Function

Parameters

TextFrom, Optional Sepa1, Optional Sepa2
Or
CellText, Optional LineSepa
Or
LineText, Optional LineSepa
Or
TextboxText, LineSepa
Or
TextboxText
Or
CellText

Views 121 Downloads 56

Perm link