Stuart McLachlan
stuart at lexacorp.com.pg
Mon Mar 10 17:05:00 CST 2003
> I'm not familiar with the Static flag. Can you explain how this works > and how I implement it? Couldn't find anything by this title in help. > Not "the" Static flag, "a" Static flag. A flag is a variable (freqently a Boolean) which you use to signal the state of something. If you Dim it as a Static variable, it's state doesn't change from call to call of the function. You can use it to tell whether the function has been called before and therefore only run a particular piece of code once. Here's an example which: Function Test(Optional reset As Long) As Long Static flgAlreadyRun As Boolean If reset = -1 Then flgAlreadyRun = False MsgBox "Function reset to 'Uncalled'" Exit Function End If If flgAlreadyRun Then MsgBox "You've already called this function once" Else MsgBox "This is the first time you've called this function" flgAlreadyRun = True End If End Function -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support.