The following example uses the SelectedVBComponent property to return the selected component.
Debug.Print Application.VBE.SelectedVBComponent.Name