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