Code Module Properties

Name

Returns

Description

CodePane

CodePane

Read-only. Returns the active CodePane for the module. If there is no visible CodePane, one is created and displayed. Note that a CodeModule can have up to two code panes, but there is no CodePanes collection for them!

CountOf

Declaration

Lines

Long

Read-only. Returns the number of lines at the top of the module used for Dim, Type, and Option statements. If there are any such items at the top of the module, any comments following them are considered to be part of the following procedure, not the declarations. The following has two declaration lines: Option Explicit Dim msSelection As String

'My Comment

Sub ProcedureStart()

If no such statements exist, comments appearing at the top of the module are counted as declaration lines, if they are followed by a blank line. The following has one declaration line:

'My Comment

Sub ProcedureStart()

If the comment is immediately followed by the procedure, it is included in the procedure's lines, so the following has no declaration line:

'My Comment

Sub ProcedureStart()

CountOfLines

Long

Read-only. Returns the total number of lines of code in the module, with line continuations counted as separate lines.

Lines

String

Read-only. Parameters: StartLine As Long, Count As Long. Returns a block of code, starting from Startline and continuing for Count lines.

Name

Returns

Description

Name

String

(Hidden) Read-only. Returns the name of the associated VBComponent.

ProcBody Line

Long

Read-only. Parameters: ProcName As String, ProcKind As vbext_ProcKind. Returns the line number of the start of the procedure, not including any preceding comments—that is, it gives the line number of the Sub, Function, or Property statement.

ProcCount Line

Long

Read-only. Parameters: ProcName As String, ProcKind As vbext_ProcKind. Returns the number of lines used by the procedure, including preceding comments, up to the End Sub, End Function, or End Property statement.

ProcOfLine

String

Read-only. Parameters: Line As Long [in], ProcKind As Long [out]. Returns the name of the procedure that a line is located within. The ProcKind argument is also modified to return the type of procedure (Sub/Function, Property Let, Get or Set). This is usually the first property to be called; the name and type returned from this are then used in calls to the other methods.

ProcStart Line

Long

Read-only. Parameters: ProcName As String, ProcKind As vbext_ProcKind. Returns the line number of the start of the procedure, including comments. Hence, ProcBodyLine -ProcStartLine gives you the number of preceding comment lines.

0 0

Post a comment