The Sub keyword is not an optional element of a sub procedure declaration. It is used to declare the start of a sub procedure. The other elements, such as parameters, public, private, and statements, are optional.
Here is an example of a sub procedure declaration:
Sub MySub()
' This is the body of the sub procedure.
End Sub
As you can see, the Sub keyword is the first element in the declaration. The other elements are optional.
Here is a table that summarizes the optional elements of a sub procedure declaration:
Element
Description
Public
Indicates that the sub procedure is accessible to all other procedures in all modules.
Private
Indicates that the sub procedure is accessible only to other procedures in the module where it is declared.
Parameters
A list of variables that are passed to the sub procedure when it is called.
Statements
The body of the sub procedure. This is where the code that executes when the sub procedure is called is placed.