The following example uses the Count property to return the number of VBComponent objects in a particular project.
Debug.Print Application.VBE.VBProjects(1).VBComponents.Count