Module.ProcBodyLine Property

Access Developer Reference

The ProcBodyLine property returns the number of the line at which the body of a specified procedure begins in a standard module or a class module. Read-only Long.

Syntax

expression.ProcBodyLine(ProcName, ProcKind)

expression   A variable that represents a Module object.

Parameters

Name Required/Optional Data Type Description
ProcName Required String The name of a procedure in the module.
ProcKind Required vbext_ProcKind The type of procedure. See the Remarks section for the possible settings.

Remarks

The ProcKind argument can be one of the following vbext_ProcKind constants:

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.

The body of a procedure begins with 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 ProcBodyLine property returns a number that identifies the line on which the procedure definition begins. In contrast, the ProcStartLine property returns a number that identifies the line at which a procedure is separated from the preceding procedure in a module. Any comments or compilation constants that precede the procedure definition (the body of a procedure) are considered part of the procedure, but the ProcBodyLine property ignores them.

Bb237727.vs_note(en-us,office.12).gif  Note
The ProcBodyLine property treats Sub and Function procedures similarly, but distinguishes between each type of Property procedure.

Example

The following example displays a message indicating on which line the procedure definition begins.

Visual Basic for Applications
  Dim strForm As String
Dim strProc As String

strForm = "Products" strProc = "Products_Subform_Enter"

MsgBox "The definition of the " & strProc & " procedure begins on line " & _ Forms(strForm).Module.ProcStartLine(strProc, vbext_pk_Proc) & "."