0
Je rencontre une situation dans laquelle j'ai besoin de clear
la variable lastWord
de sorte que msgbox
ne montre rien dans le prochain loop
.Effacer/Vider la variable pour la prochaine boucle
Le code suivant est juste un exemple.
Sub clear_lastWord_Variable()
Dim wordArr() As String
Dim lastword As String
Do
selection.Find.ClearFormatting
selection.Find.Font.Bold = True
With selection.Find
.Forward = True
.Wrap = wdFindStop
End With
selection.Find.Execute
If selection.Find.Found Then
wordArr = Split(selection, " ")
For i = LBound(wordArr) To UBound(wordArr) Step 1
lastword = wordArr(i)
Next i
MsgBox lastword
' here should be something to clear lastword
Else
Exit Do
End If
Loop
End Sub