1 / 4

The Event Loop

The Event Loop. Events. Events are things that happen when your program is running There are lots of events, like: Opening the workbook Clicking a command button Typing in a text box or a spreadsheet cell Etc. etc. etc.

deva
Download Presentation

The Event Loop

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Event Loop

  2. Events • Events are things that happen when your program is running • There are lots of events, like: • Opening the workbook • Clicking a command button • Typing in a text box or a spreadsheet cell • Etc. etc. etc. • If there is code for an event, something happens; otherwise, it is ignored

  3. The Event Loop • In VBA, when you run your program, the system is running in a continuous loop (a Do While TRUE loop) constantly looking for events and seeing if it has code for them • When an event for which there is an event procedure occurs, the VBA system executes the procedure, and then goes back to checking • The event loop stops running when you quit the program

  4. An Illustration • We’ll look at a demo of the Ice Cream Store that illustrates this behavior (Ice Cream Loops) • It can be run over and over to make multiple entries on the spreadsheet and in the listbox • It uses global variables to track some statistics over multiple sales

More Related