Quit Your App on Start-up

VBCE cannot use a Sub Main procedure for the startup object for the application, therefore the startup object must be a form. If, during the start-up of your application (Form_Load) you decide that the application needs to terminate, you must cannot use the App.End method in the Form_Load event or an application error will result (See Q183420 and Q180520).

To prevent the error and end the application during start up, you must terminate in the Form_Activate Event (you should tell the user with a message box). We do this by setting a "flag" for us to check at a later time, during the form Activate event.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.