I've got a function that walks through all files on my harddrive. Depending on the user's settings it has to do a specific operation on those files.
Incuding the code for all of these operations in the function that walks through my files would mess-up my code.
Now I used select case to find out which function to use. When I add a new function, I always have to add it in the Walkthroughfiles function.
Isn't there an easier way to do this?
Private Function Walkthroughfiles(option as string)
'Select next file...
Select Case option
Case "One": a = One
Case "Two": a = Two
'Loop...
End Select
msgbox a
End Function
Public Function One()
'Some code
One = "operation 1 completed successfully)
End Function
Public Function Two()
'Some code
Two = "operation 2 completed successfully)
End Function


Reply With Quote