1. Loop through every file in the directory and add the total.
Code:
stFileList = dir$("c:\myDir\*.*")
do while stFileList <> ""
lSize = lSize + filelen(stfilelist)
stfilelist = dir
loop
2. You will need to add a exit clause to the function. E.g a boolean. When the user clicks the cancel button, set the boolean = true.
Code:
Priavte Sub cmdCancel_Click()
blCancel = True
End Sub
Priavte Sub myLoop()
stFileList = dir$("c:\myDir\*.*")
do while (stFileList <> "") and (blcancel = False)
lSize = lSize + filelen(stfilelist)
stfilelist = dir
doevents
loop
end sub