Article ID: 109780
Article Last Modified on 6/11/2007
Sub One()
MsgBox ("One()") ' Displays message box.
' Sends control to Line10 below.
' The GoTo Line10 statement directs the program to branch to the
' line labeled "Line10:", the message box "unexecuted code" is
' skipped.
GoTo Line10
' This message box is not displayed.
MsgBox ("unexecuted code")
Line10:
' Displays message box.
MsgBox ("Line10 of One()")
' The "Call Two()" line executes the subroutine defined as "Two()",
' sends a message box indicating that the subprocedure is executing,
' then returns to Sub One executing the line immediately after the
' Call statement.
' Call made to Sub procedure named two()
Call Two
' Message box displayed.
MsgBox ("back to One(); returning from Two()")
End Sub
Sub Two()
' Message box displayed.
MsgBox ("Two()")
End Sub
NOTE: The sample code above does not pass any arguments.
Sub One()
MsgBox ("One()") ' Message box displayed.
two ' Call made to Sub named two().
MsgBox ("return from Two()") ' Message box displayed.
End Sub
Sub Two()
MsgBox ("Two()") ' Message box displayed.
End Sub
Sub GetInput()
Dim number as Integer ' Used for input variable.
' User input requested. Val() to turn input text into a number.
number = Val(InputBox("Enter a 1 or a 2."))
' Condition that is evaluated based on user input.
If number = 1 Or number = 2 Then
GoTo Line1
Else
GoTo Line2
End If
Line1:
MsgBox ("Great! You entered a " & number & ".")
GoTo LastLine
Line2:
MsgBox ("Sorry, you must enter a 1 or a 2.")
LastLine:
MsgBox ("End of program.")
End Sub
Additional query words: 5.00a 5.00c 7.00a XL98 XL97 XL7 XL5 XL
Keywords: kbdtacode kbhowto kbprogramming KB109780