Author Topic: Exit Properly?  (Read 2183 times)

0 Members and 1 Guest are viewing this topic.

rude dog

  • Guest
Exit Properly?
« on: April 09, 2008, 05:03:45 PM »
How do  get this piece of to exit smoothly without bombing out if the user selects a point out in space or right clicks?

Code: [Select]
Public Sub GetEntExample()

 Dim returnObj As AcadObject
    Dim basePnt As Variant
   
    On Error Resume Next
   
    ' The following example waits for a selection from the user
RETRY:
    ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"
   
    If Err <> 0 Then
        Err.Clear
        MsgBox "Program ended.", , "GetEntity Example"
        Exit Sub
    Else
        returnObj.Update
        MsgBox "The object type is: " & returnObj.EntityName, , "GetEntity Example"
        returnObj.Update
    End If
   
    GoTo RETRY
End Sub


David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Exit Properly?
« Reply #1 on: April 09, 2008, 06:00:25 PM »
what exactly are you referring to?  It did exactly what I expected it to
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Exit Properly?
« Reply #2 on: April 09, 2008, 06:01:28 PM »
I guess what I mean is do you want to avoid the Program ended msgbox or do you want it to say "You missed picking something, try again" or what ?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Bryco

  • Water Moccasin
  • Posts: 1882
Re: Exit Properly?
« Reply #3 on: April 09, 2008, 06:05:28 PM »

rude dog

  • Guest
Re: Exit Properly?
« Reply #4 on: April 09, 2008, 07:29:30 PM »
At Lunch time today it wasnt working properly I had about 4 or 5 different versions up  :oops:
This one does work though
Thanks for the other thread as well looks very useful.

rude dog

  • Guest
Re: Exit Properly?
« Reply #5 on: April 10, 2008, 11:36:19 AM »
Found out what the problem was @ work
In the Tools --> Options box in the VBA IDE I had the box checked that said "Break on all Errors"
when it should have been set up to break on Unhandled errors.
Thanks