Ini merupakan fungsi yang digunakan untuk membuat personal editor. Tag yang akan kita modifikasi adalah tag OL (Ordering List).
Option Explicit
Function OL(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 = "<ol>" & "<li>" & aText(i) & "</li>" & vbCrLf
Case UBound(aText)
sText = sText & "<li>" & aText(i) & "</li>" & "</ol>"
Case Else
sText = sText & "<li>" & aText(i) & "</li>" & vbCrLf
End Select
Next
OL = sText
End Function
Cara penggunaan Fungsi Personal Editor HTML Ordering List <OL>
Private Sub Command1_Click()
Text1.SelText = OL(Text1.SelText)
End Sub