Pages

Wednesday, March 21, 2012

The GoTo Statement

The GoTo Statement

Sub GoToDemo()

UserName = InputBox(“Enter Your Name: “)

If UserName <> “Bill Gates” Then GoTo WrongName

MsgBox (“Welcome Bill...”)

‘ ...[More code here] ...

Exit Sub

WrongName:

MsgBox “Sorry. Only Bill Gates can run this.”

End Sub

 

No comments:

Post a Comment