Article ID: 113046
Article Last Modified on 10/11/2006
Sub SubComputeArea(Length, Width) ' Sub with two arguments.
Dim Area As Double ' Declare local variable.
If Length = 0 Or Width = 0 Then ' If either argument = 0.
Exit Sub ' Exit Sub immediately.
End If
Area = Length * Width ' Calculate area of rectangle.
Debug.Print Area ' Print Area to Debug window.
End Sub
In the example, a variable called Width is used. Width is a reserved
keyword in Visual Basic and cannot be used as a variable.
Sub SubComputeArea(Length, gWidth) ' Sub with two arguments.
Dim Area As Double ' Declare local variable.
If Length = 0 Or gWidth = 0 Then ' either argument = 0.
Exit Sub ' Exit Sub immediately.
End If
Area = Length * gWidth ' Calculate area of rectangle.
Debug.Print Area ' Print Area to Debug window.
End Sub
Additional query words: 5.00c 7.00a XL5 XL7 XL DocErr
Keywords: kbcode kbprogramming KB113046