Message 1 of 5
Resume statement
Not applicable
10-15-2002
07:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Howdy all,
I have the following code... if the user selects an invalid object, I want a
message box displayed and then allow the user to make a new selection. When
I try to force an error by picking on a non text item, I get my message box
as normal, but I can not dismiss the message box and AutoCAD and VBA hang.
I have gotten it to work by adding the line argument after resume i.e.
Resume 21, but I then get two message boxes from the error before allowing
the user to make a new selection.
Dim objText As AcadText
Dim Ent1 As AcadEntity
On Error GoTo Err_Control:
ThisDrawing.Utility.GetEntity Ent1, PtNothing, "Select text object."
Ent1.Highlight True
If TypeOf Ent1 Is AcadText Then
Set objText = Ent1
Else
GoTo Err_Control
End If
Err_Control:
Select Case Err.Number
Case Else
Err.Clear
MsgBox "The object you selected is not a text object. Please make a
new selection.", vbExclamation, "My Error"
Ent1.Highlight False
Resume
End Select
Anyone have any ideas?
TIA.
--
Rob
I have the following code... if the user selects an invalid object, I want a
message box displayed and then allow the user to make a new selection. When
I try to force an error by picking on a non text item, I get my message box
as normal, but I can not dismiss the message box and AutoCAD and VBA hang.
I have gotten it to work by adding the line argument after resume i.e.
Resume 21, but I then get two message boxes from the error before allowing
the user to make a new selection.
Dim objText As AcadText
Dim Ent1 As AcadEntity
On Error GoTo Err_Control:
ThisDrawing.Utility.GetEntity Ent1, PtNothing, "Select text object."
Ent1.Highlight True
If TypeOf Ent1 Is AcadText Then
Set objText = Ent1
Else
GoTo Err_Control
End If
Err_Control:
Select Case Err.Number
Case Else
Err.Clear
MsgBox "The object you selected is not a text object. Please make a
new selection.", vbExclamation, "My Error"
Ent1.Highlight False
Resume
End Select
Anyone have any ideas?
TIA.
--
Rob