VBA verifier format text richtextbox

tchuk57 Messages postés 9 Date d'inscription mardi 27 juin 2006 Statut Membre Dernière intervention 8 septembre 2008 - 8 sept. 2008 à 10:25
LIBRE_MAX Messages postés 1402 Date d'inscription mardi 1 mai 2007 Statut Membre Dernière intervention 7 octobre 2012 - 8 sept. 2008 à 11:43
Bonjour à tous!!!

Je souhaiterai savoir comment verifier  le format  du text contenu dans un richtextbox
En effet , je voudrai verifier si toutes mes lignes contenu dans ce richtextbox commence par "Part" et se termine par "NOGO" . Par exemple:

Part 2 blabalabala NOGO
Part 12 balalavalala NOGO

Auriez vous uine solution?
Je vous remercie d'avance
Cordialement

tchuk






 

1 réponse

LIBRE_MAX Messages postés 1402 Date d'inscription mardi 1 mai 2007 Statut Membre Dernière intervention 7 octobre 2012 6
8 sept. 2008 à 11:43
Bonjour,
Dim T() As String
T = Split(rtfBox.Text, Chr(10))


Dim i as integer
For i=0 To Ubound(T)-1
  If Left$(T(i),4) <> "Part"   Or _
     Right$(T(i),4)<>"NOGO" Then
     MsgBox "Condition non vérifiée à la ligne : " & i
     Exit For
  End If
Next
       
<hr />


[] Ce qui va sans dire. va mieux en le disant.


<hr />
0
Rejoignez-nous