A GoTo statement with a condition : GoTo « Language Basics « VBA / Excel / Access / Word






A GoTo statement with a condition

 
Sub gotoDemo()
    Dim Response As Integer
    Response = MsgBox("Do you want to create a daily report for " & _
        "the head office from the current document?", _
        vbYesNo + vbQuestion, "Create Daily Report")
    If Response = vbNo Then GoTo Bye
Bye:
End Sub

 








Related examples in the same category

1.A line number is simply a number placed at the beginning of a line to identify it. For example, consider this demonstration of GoTo:
2.how a GoTo statement works:
3.Use GoTo to do a loop