次の方法で共有


Invalid 'exit' statement

You used an Exit statement inside one of the following program control constructs:

  • With Statement.

  • If...Then...Else Statement.

  • Select Case Statement.

You can legally use an Exit statement to leave these structures only:

  • Do...While loop         (Exit Do).

  • For...Next loop         (Exit For).

  • For Each...Next loop   (Exit For).

  • Function procedure      (Exit Function).

  • Sub procedure         (Exit Sub).

To correct this error

  • You may have improperly used Exit If, Exit With, or Exit Select.

  • Do not use Exit with If, With, or Select statements.

See Also

Reference

Exit Statement

Do...Loop Statement

For Each...Next Statement

For...Next Statement

Function Statement (VBScript)

Sub Statement