ProcOfLine Method

Applies To

CodeModule object.

Description

Returns the name of the procedure that the specified line is in.

Syntax

object.ProcOfLine(line, prockind) As String

The ProcOfLine syntax has these parts:

Part

Description

object

Required. An object expression that evaluates to an object in the Applies To list.

line

Required. A Long specifying the line to check.

prockind

Required. Specifies the kind of procedure to locate. Because property procedures can have multiple representations in the module, you must specify the kind of procedure you want to locate. All procedures other than property procedures (that is, Sub and Function procedures) use vbext_pk_Proc.


You can use one of the following constants for the prockind argument:

Constant

Description

vbext_pk_Get

Specifies a procedure that returns the value of a property.

vbext_pk_Let

Specifies a procedure that assigns a value to a property.

vbext_pk_Set

Specifies a procedure that sets a reference to an object.

vbext_pk_Proc

Specifies all procedures other than property procedures.


Remarks

A line is within a procedure if it's a blank line or comment line preceding the procedure declaration and, if the procedure is the last procedure in a code module, a blank line or lines following the procedure.

See Also

CodePane object, DeleteLines method, Find method, GetSelection method, InsertLines method, ProcBodyLine method, ProcCountLines method, ProcStartLine method.

Example

The following example uses the ProcOfLine method to return the name of the procedure containing the specified line number in a particular code pane.

Debug.Print Application.VBE.CodePanes(3).CodeModule.ProcOfLine (1270, _
    vbext_pk_Proc)