expression.ProcCountLines(ProcName, ProcKind)
expression Required. An expression that returns one of the objects in the Applies To list.
ProcName Required String. The name of a procedure in the module.
ProcKind Required vbext_ProcKind. The type of procedure. The constant may be one of the following values.
Constant | Description |
---|---|
vbext_pk_Get | A Property Get procedure. |
vbext_pk_Let | A Property Let procedure. |
vbext_pk_Proc | A Sub or Function procedure. |
vbext_pk_Set | A Property Set procedure. |
Remarks
The ProcCountLines property is available only by using Visual Basic.
The procedure begins with any comments and compilation constants that immediately precede the procedure definition, denoted by one of the following:
- A Sub statement.
- A Function statement.
- A Property Get statement.
- A Property Let statement.
- A Property Set statement.
The ProcCountLines property returns the number of lines in a procedure, beginning with the line returned by the ProcStartLine property and ending with the line that ends the procedure. The procedure may be ended with End Sub
, End Function
, or End Property
.
Note The ProcCountLines property treats Sub and Function procedures similarly, but distinguishes between each type of Property procedure.
Example
The following example displays a message indicating the number of lines in a given procedure.
Dim strForm As String
Dim strProc As String
strForm = "Products"
strProc = "Form_Activate"
MsgBox "There are " & Forms(strForm).Module.ProcCountLines(strProc, vbext_pk_Proc) & _
" lines in the " & strProc & " procedure."