Ini merupakan fungsi yang digunakan untuk membuat personal editor. Tag yang akan kita modifikasi adalah tag UL (Unordering List).
Option Explicit
Function UL(strText As String) As String
Dim sText As String
Dim aText() As String
Dim i As Integer
sText = strText
aText = Split(sText, vbCrLf)
For i = LBound(aText) To UBound(aText)
Select Case i
Case LBound(aText)
sText = "<ul>" & "<li>" & aText(i) & "</li>" & vbCrLf
Case UBound(aText)
sText = sText & "<li>" & aText(i) & "</li>" & "</ul>"
Case Else
sText = sText & "<li>" & aText(i) & "</li>" & vbCrLf
End Select
Next
UL = sText
End Function
Cara penggunaan Fungsi Personal Editor HTML Unordering List <UL>
Private Sub Command1_Click()
Text1.SelText = UL(Text1.SelText)
End Sub