The following example uses the CountOfDeclarationLines property to return the number of declaration lines in a particular code pane.
Debug.Print Application.VBE.CodePanes(2).CodeModule.CountOfDeclarationLines