There are a few problems. You have a variable SelectFolder that is used to define the folder to be looked at which isn't declared, but it isn't loaded with a folder name either. You also call a function CreateFilename, but in your code it is CreaeFilename, that are different.