What is a Call Stack?

The concept of a call stack explained in under 100 words. #Under100

What is a Call Stack?

In programming, a call stack is a last-in, first-out listing of procedure calls.

Real World Analogy

My wife has a question for my son, Luke, but he's off in the woods.  So the question gets relayed through the whole family:

Allison asks Mike
Mike asks Chloe
Chloe asks Mia
Mia asks Cooper
Cooper asks Luke

Unwinding the Stack

As each person responds, the stack shrinks:

Cooper hears from Luke
Mia hears from Cooper
Chloe hears from Mia
Mike hears from Chloe
Allison hears from Mike

Viewing the Call Stack

To view the call stack in VBA, go to View > Call Stack... (Ctrl + L).  

Note that the call stack window is only available while the code is executing.


Image by PublicDomainPictures from Pixabay

UPDATED [2021-11-05]: Added sample code to the VBA Call Stack screenshot; added image credit.

All original code samples by Mike Wolfe are licensed under CC BY 4.0