While S1 > 0 S1 = InStr(S1, td, ("Début"), vbTextCompare) S2 = InStr(S1 + 1, td, ("fin"), vbTextCompare) 'Reponse negative si rien trouvé If S1 > S1Precedent Then If S1 = 0 Or S2 = 0 Or IsNull(S1) Or IsNull(S2) Then Debug.Print "Aucune correspondance trouvée" Exit Sub Else 'recup url article S1 = S1 + Len("Début") bU = S2 - S1 S2 = S2 + Len("Fin") foundstr1 = Mid(td, S1, bU) End If Text2 = Text2 & " " & foundstr1 & vbCrLf End If Wend End If
Beep
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Command1_Click()
td = "cccccccccDébutchainefinkggjkhgjhgjhgjhgDébutchaine2finnhfffhgfhDébutddddfinxxxx"
reste = td
pos1 = InStr(reste, "Début")
pos2 = InStr(reste, "fin")
If pos1 = 0 Or pos2 = 0 Then MsgBox "rien trouvé": Exit Sub
Do While pos1 > 0
reste = Mid(reste, pos1 + Len("Début"))
pos2 = InStr(reste, "fin")
If pos2 = 0 Then Exit Sub
trouve = Left(reste, pos2 - 1)
Text2.Text = Text2.Text & trouve & vbCrLf: Beep
reste = Mid(reste, pos2 + Len("fin"))
pos1 = InStr(reste, "Début")
Loop
End Sub
Private Sub Command1_Click()
Text2.Text = ""
td = "cccccccccDébutchainefinkggjkhgjhgjhgjhgDébutchaine2finnhfffhgfhDébutddddfinxxxx"
on_traite = Replace(td, "Début", "fin" & Chr(1))
toto = Split(on_traite, "fin")
For i = 0 To UBound(toto)
If Left(toto(i), 1) = Chr(1) Then
Text2.Text = Text2.Text & Mid(toto(i), 2) & vbCrLf: beep
End If
Next
End Sub