Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

VBA Error on GetEntity

dennis
Advisor

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
Reply
Accepted solutions (1)
1,332 Views
1 Reply
Reply (1)

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

Type a product name