Statement is illegal outside of a subprogram
You used a statement that is not legal at the module level. These statements include:
- End statement
- Execute statement
- GoSub statement
- GoTo statement
- If...GoTo statement
- On Error statement
- On...GoTo statement
- On...GoSub statement
- Resume statement
- Return statement
- SendKeys statement
- Yield statement
Revise the script to remove any of these statements at the module level.