Here is a function I use to select a subentity. It allows the operator to use <Enter> to exit the subroutine, so your main code needs to check if the returned object is Nothing and exit quietly.
Code:
Option Explicit
Private Function SelectSubEnt(Optional Msg As String = "Select object: ") As AcadEntity
Dim myMsg As String
myMsg = vbCrLf & Msg
Dim pickObj As AcadEntity
Dim pickPt As Variant
Dim pickMatrix As Variant
Dim pickContext As Variant
Dim ErrNo As Integer
ErrNo = 0
With ThisDrawing
On Error GoTo CheckErr
.SetVariable "ErrNo", ErrNo
.Utility.GetSubEntity pickObj, pickPt, pickMatrix, pickContext, myMsg
End With
Set SelectSubEnt = pickObj
ExitHere:
Exit Function
CheckErr:
Debug.Print Err.Description
If InStr(1, Err.Description, "failed", vbTextCompare) > 0 Then
ErrNo = CInt(ThisDrawing.GetVariable("ErrNo"))
If ErrNo = 52 Then
Err.Clear
Resume ExitHere
ElseIf ErrNo = 7 Then
Err.Clear
Resume
End If
Else
MsgBox Err.Description
Resume ExitHere
End If
End Function
Sub Test()
Dim myObj As AcadEntity
Set myObj = SelectSubEnt
If myObj Is Nothing Then
MsgBox "User hit <Enter>, exit quietly."
Else
MsgBox "Found object: " & myObj.ObjectName
End If
End Sub