Statement labels

Statement labels can appear only within procedures. A statement at module level in a script -- not contained within a procedure -- cannot be labeled. Since any given label is known only within the procedure where it is defined, a branching statement that may transfer control to a labeled statement can appear only within the same procedure as the labeled statement. The statements that may transfer control to a labeled statement are GoTo, GoSub, On...GoTo, On...GoSub, If...GoTo...Else, and Resume. If an error occurs that is governed by an On Error...GoTo label statement, the On Error statement and the labeled statement must be in the same procedure.