A subroutine is a block of code like function that do a specific task. The difference between subroutine and function is that a subroutine does not return a value. However, you may pass arguments to a subroutine in VB 6.
The syntax for subroutine is given below, the keywords within square bracket ([ ]) are optional.
[Private | Public | Friend] [Static] Sub-name [(argument list)] ... [Statements] ... [Exist Sub] ... [Statements] ... End Sub
Public keyword allows procedures from all forms and modules to access the public procedures.
Private keyword only allows access to procedures from forms and modules where private procedure is declared.
Friend keyword used in class modules (modules that implement classes) allows the procedure to be visible throughout the project except to the controller of the instance of an object.
Static keyword preserve the value of local variable (those declared inside the procedure) between calls. You can call a procedure several times, it would not lose the value of a static local variable.
Argument list is a list of variables that it passed to the procedure. You can have multiple arguments each separated by a comma.