VBA Error on GetEntity

VBA Error on GetEntity

dennis
Advisor Advisor
1,415 Views
1 Reply
Message 1 of 2

VBA Error on GetEntity

dennis
Advisor
Advisor

I am calling ThisDrawing.Utility.GetEntity to select a line.  I catch the error if the user hits <return> where I prompt "Invalid selection" and then use End to exit out of the program.

 

Then I get the following message:

Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.

 

Any help to keep this message from appearing would be helpful.

 

0 Likes
Accepted solutions (1)
1,416 Views
1 Reply
Reply (1)
Message 2 of 2

Alfred.NESWADBA
Consultant
Consultant
Accepted solution

Hi,

 

are you starting a VBA macro from a LISP?

 

>> then use End

"End" is something very hard to terminate a program. I wouldn't do that, I would use something like that following code-snippet which let the function or sub end in a normal way

 

Public Sub TEST
   .....
   On Error Resume Next
   ThisDrawing.Utility.GetEntity ....
   If Err.Number = 0 then
      On Error Goto 0
      ...
      'here run your code with the selected line
   End If
End Sub

HTH, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes