
The Visual Basic Environment
Procedures
Procedures encompass both functions and subroutines. These
can be distinguished by the syntax in which they appear.
This procedure is a subroutine:
Sub Subroutine1()
'Underlying Code
End Sub
This procedure is a function:
Function Function1() As Integer
'Underlying code and return value
End Function
There are two ways to insert a procedure into a code module.
The first is to choose the appropriate module and then choose
Insert | Procedure, which opens the dialog box shown in Fig-
ure 3-23.
The second (and easier) method is just to type either “Sub” for
a subroutine or “Function” for a function followed by the
appropriate ...