Illegal EXIT <EXIT type>
You used an Exit statement of a particular type outside a block statement of that type. The six types of Exit statement, and the block statements where each can appear, are as follows:
- Exit Do can appear only within a Do statement
- Exit For can appear only within a For statement
- Exit ForAllcan appear only within a ForAll statement
- Exit Functioncan appear only within a Function statement
- Exit Subcan appear only within a Sub statement
- Exit Propertycan appear only within a Property Get statement or a Property Set statement
If the Exit statement is unintended, remove it.
If the Exitstatement has the correct type but is misplaced, relocate it to within the intended block of that type.
If the Exitstatement is in the intended place within a block but has the wrong type, change its type to the type of that block.