Module.ProcStartLine property (Access)

The ProcStartLine property returns a value identifying the line at which a specified procedure begins in a standard module or a class module. Read-only Long.

Syntax

expression.ProcStartLine (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 Se t procedure.

A 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 ProcStartLine property returns the number of the line on which the specified procedure begins. The beginning of the procedure may include comments or compilation constants that precede the procedure definition.

To determine the line on which the procedure definition begins, use the ProcBodyLine property. This property returns the number of the line that begins with a Sub, Function, Property Get, Property Let, or Property Set statement.

The ProcStartLine and ProcBodyLine properties can have the same value if the procedure definition is the first line of the procedure. If the procedure definition isn't the first line of the procedure, the ProcBodyLine property will have a greater value than the ProcStartLine property.

It may be easier to determine where a procedure begins if you have the Procedure Separator option selected. With this option selected, there is a line between the end of a procedure and the beginning of the next procedure. The first line of code (or blank line) below the procedure separator is the first line of the following procedure, which is the line returned by the ProcStartLine property. The Procedure Separator option is located on the Editor tab of the Options dialog box, available by choosing Options on the Tools menu.

Note

The ProcStartLine property treats Sub and Function procedures similarly, but distinguishes between each type of Property procedure.

Example

The following example displays a message indicating where a particular procedure starts in a particular form module.

Dim strForm As String 
Dim strProc As String 
 
strForm = "Products" 
strProc = "Form_Activate" 
 
MsgBox "The procedure " & strProc & " starts on line " & _ 
 Forms(strForm).Module.ProcStartLine(strProc, vbext_pk_Proc) & "."

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.