◄Contents► ◄Index► ◄Back► ────────────────────────────────────────────────────────────────────────────── Automatic and Static Variables ■ Visual Basic procedures can use either automatic or static variables: • Automatic variables are initialized at the start of each call to a SUB or FUNCTION statement. • Static variables retain values between calls. ■ Use the STATIC keyword in a SUB or FUNCTION statement to determine whether a procedure's variables are automatic or static: • If STATIC is omitted, then the variables are automatic. • If STATIC is included, then the variables are static - that is, the values of the variables are saved between procedure calls. See: ◄FUNCTION Statement► ◄SUB Statement► ■ To make selected variables in a procedure static: • Omit STATIC from the SUB or FUNCTION statement to make the variable automatic. • Name one or more variables in a STATIC statement. See: ◄STATIC Statement► See: ◄Variables Summary►