Goto Statement |
Syntax
GoTo label
label
Use: Required
Subroutine name.
Description
Passes execution to a subroutine within a procedure.
Rules at a Glance
label must be a subprocedure defined within the same procedure as Goto.
Programming Tips and Gotchas
The only time a modern VB program should include a Goto statement is in an error handler, as in:
On Error Goto My_Sub_Err
For more information on error handling, see Chapter 6.
See Also
- GoSub...Return Statement, Chapter 6
Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.