keujr‖

piD5w‖While...Wend Statement

QMYRt‖When a program encounters a While statement, it tests the condition. If the condition is False, the program continues directly following the Wend statement. If the condition is True, the loop is executed until the program finds Wend and then jumps back to the While statement. If the condition is still True, the loop is executed again.

McvNv‖Unlike the Do...Loop statement, you cannot cancel a While...Wend loop with Exit. Never exit a While...Wend loop with GoTo, since this can cause a run-time error.

s8j22‖A Do...Loop is more flexible than a While...Wend.

FVEx2‖Syntax:

jACFc‖ While syntax


    While Condition [statements] Wend

EFSA4‖Example:


  Sub ExampleWhileWend
      Dim stext As String
      Dim iRun As Integer
  Cw5AE‖    sText ="This is a short text"
      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
  qqkJw‖    MsgBox sText,0,"Text encoded"
  End Sub

Tu4uw‖Do...Until or Do...While statement

CroFU‖Exit statement