This documentation is archived and is not being maintained.

CountOfDeclarationLines Property [Access 2003 VBA Language Reference]

Office 2003

The CountOfDeclarationLines property returns a Long value indicating the number of lines of code in the Declarations section in a standard module or class module. Read-only Long.

expression.CountOfDeclarationLines

expression Required. An expression that returns one of the objects in the Applies To list.

Setting

The CountOfDeclarationLines property is available only by using Visual Basic and is read-only.

Remarks

Lines in a module are numbered beginning with 1.

The value of the CountOfDeclarationLines property is equal to the line number of the last line of the Declarations section. You can use this property to determine where the Declarations section ends and the body of the module begins.

Example

The following example counts the number of lines and declaration lines in each standard module in the Modules collection. Note that the Modules collection contains only modules that are open in the module editor.

Public Sub ModuleLineTotal(ByVal strModuleName As String)

    Dim mdl As Module

    ' Open module to include in Modules collection.
    DoCmd.OpenModule strModuleName
    
    ' Return reference to Module object.
    Set mdl = Modules(strModuleName)
    
    ' Print number of lines in module.
    Debug.Print "Number of lines: ", mdl.CountOfLines
    
    ' Print number of declaration lines.
    Debug.Print "Number of declaration lines: ", _
        mdl.CountOfDeclarationLines
        
End Sub
		


Applies to | Module Object



Show: