While...Wend Statement
Cuando un programa atopa una instrucción While, comprueba la condición. Si la condición ye False, el programa continúa direutamente siguiendo la instrucción Wend. Si la condición ye True, el bucle execútase fasta que'l programa atopa Wend y dempués vuelve a la instrucción While. Si la condición sigue siendo True, el bucle vuelve a executase.
Al contrariu qu'el bucle Do...Loop, While...Wend nun pue encaboxase con Colar. Nun sala nunca d'un bucle While...Wend con GoTo, una y bones ello podría provocar un fallu de tiempu d'execución.
Un Do...Loop ye más flexible qu'un While...Wend.
Sintaxis:
While Condición [Instrucción] Wend
Exemplu:
Sub ExempluWhileWend
Dim sTestu As String
Dim iRun As Integer
sText ="Esto ye un testu curtiu"
iRun = 1
While iRun < Len(sText)
If Mid(sText,iRun,1 )<> " " Then Mid( sText ,iRun, 1, Chr( 1 + Asc( Mid(sText,iRun,1 )) )
iRun = iRun + 1
Wend
MsgBox sTestu,0,"Testu codificado"
End Sub