Find the code pane
Public Sub FindCodePane() Dim codePane As VBIDE.codePane Set codePane = Application.VBE.ActiveCodePane MsgBox codePane.TopLine End Sub