Here is a little bit of an optimization...
private userCanceled as boolean
for i = 0 to upper 'upper can be some really big number
if userCanceled then exit for
'do the loop code
if i mod 100 = 0 then 'only run the doevents after every 100th iteration, this save some processor overhead..
doevents
endif
next i
'================
If it is really critical that the code stop execution immediately after the button has been pressed, then by all means forget the iteration test. If you are searching for files and you just want to stop the search, then the iteration test will help emmensly(sp?)....
Troy Williams B.Eng.
fenris@hotmail.com