Find the selected component in VBIDE
Public Sub FindSelectedComponent() Dim component As VBIDE.VBComponent Set component = Application.VBE.SelectedVBComponent MsgBox component.Name End Sub