Ya he creado una versión de la sub CambiaColores bastante más rápida. A ver si no aparecen bugs.
Código vb:
Ver originalSub CambiaColores(RTB As RichTextBox)
Dim Pos As Long
Dim PosAbre As Long
Dim PosCierra As Long
Dim Contador As Long
With RTB
Do
PosAbre = InStr(Pos + 1, RTB.Text, "{")
PosCierra = InStr(Pos + 1, RTB.Text, "}")
If PosAbre > 0 And (PosAbre < PosCierra Or PosCierra = 0) Then
.SelStart = Pos
.SelLength = PosAbre - Pos - 1
.SelColor = Colores(Contador)
If Contador < 5 Then Contador = Contador + 1
.SelStart = PosAbre - 1
.SelLength = 1
.SelColor = Colores(Contador)
Pos = PosAbre
ElseIf PosCierra > 0 Then
.SelStart = Pos
.SelLength = PosCierra - Pos
.SelColor = Colores(Contador)
If Contador > 0 Then Contador = Contador - 1
Pos = PosCierra
Else
.SelStart = Pos
.SelLength = Len(RTB.Text)
.SelColor = Colores(Contador)
Exit Do
End If
Loop
End With
End Sub
A ver si alguien publica un "aleatori-libro" de aventuras
Saludos