NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Sub Statement Example

This example uses the Sub statement to define the name, arguments, and code that form the body of a Sub procedure.

' Sub procedure definition.
' Sub procedure with two arguments.
Sub SubComputeArea(Length, TheWidth)
   Dim Area As Double   ' Declare local variable. 
   If Length = 0 Or TheWidth = 0 Then
   ' If either argument = 0.
      Exit Sub   ' Exit Sub immediately.
   End If
   Area = Length * TheWidth   ' Calculate area of rectangle.
   Debug.Print Area   ' Print Area to Debug window.
End Sub