Example - Static Statement
' This example shows how To use the Static keyword to retain the value of ' the variable i in the AddValue subroutine. When defining i, if Dim is used instead of Static ' then i is empty when printed On the second call as well as the first call. Sub Main() For j = 1 To 2 Call AddValue Next j End Sub Sub AddValue ( ) Static i MsgBox "In AddValue. i is " & i i = i + 5 MsgBox "In AddValue. Added five to i. i is now " & i End Sub