Sub Procedures

Sub procedures are procedures which do not return a value. The syntax for a Sub procedure is as given below :

[Private|Public][Static]Sub procedurename (arguments)
statements
End Sub

Arguments is a list of argument names, separated by commas if there is more than one. Each argument looks like a variable declaration and acts like a variable in the procedure.

Each time the procedure is called, the statements between Sub and End Sub are executed. Sub procedures can be placed in Standard modules, Class modules, and Form modules. Sub procedures are by default Public in all modules, which means they can be called from anywhere in the application.

In Visual Basic, it’s useful to distinguish between two types of Sub procedures, general procedures and event procedures.

No comments:

Post a Comment