VBA end code execution. Equivalent = (CTRL + BREAK + END)

VBA end code execution. Equivalent = (CTRL + BREAK + END)

Anonymous
Not applicable
3,978 Views
1 Reply
Message 1 of 2

VBA end code execution. Equivalent = (CTRL + BREAK + END)

Anonymous
Not applicable

Hi,

 

I have a big macro running in Inventor and when an error appears I have a handler that shows a message on the screen:

 

Resume

errHandler:

MsgBox Err.Description

Err.Clear

ResumeerrHandler:MsgBox Err.Description

Err.Clear

 

The problem is that the message appears on the screen and when the user clicks OK, the application continues executing the code and it becomes a disaster.

 

I was wondering if there is a code equivalent to ( CTRL + BREAK + END) that can end the code execution when an error appears.

 

Best Regards,

 

Daniela Dubois

Software para Innovación Tecnológica S.A. de C.V..

 

 

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

Anonymous
Not applicable
Accepted solution

Sure you can use the keyword "END" which just stops your program.

Be aware though that this is an emergency stop.  No clean up is done. 

Anything your in the middle of is left hanging.

 

A Better approach is to:

   Stop any processes your program is doing

   Release any resources your using

   Close any files you have open.

   Unload any child forms

   Unload the main form.

 

~Gruff

0 Likes