How It Works

The TestCaseStatement procedure accepts a string variable called strCountry as a parameter.

Sub TestCaseStatement(strCountry As String)

The strCountry variable is evaluated in the Select...Case statement to determine which one of a variety of messages should be displayed.

'evaluate the value of strCountry and display applicable result in debug window Select Case strCountry Case "Italy"

The buildings dating back to 400 BC are incredible."

Debug.Print Case "China"

Debug.Print Case "Russia"

Debug.Print Case "Germany"

Debug.Print Case Else

Debug.Print End Select

Great bargains for shoppers."

A beautiful country with a growing democracy." Fantastic food - you will not starve there." You should travel more when you have the chance."

Because you ran the procedure using "Italy" as the value for Country, the message for Italy was displayed in the Immediate Window. Try running the procedure with different values for Country and see how the results differ.

0 0

Post a comment