Hi,

I have a userform that creates scenarios. In order to save them there are two options:

Set fso = CreateObject("Scripting.FileSystemObject")

  1. If the folder named [scenario] doesn't exist, create it with fso.createfolder("path")
  2. If the folder named [scenario] exists, delete
it with fso.deletefolder("path") create it with fso.createfolder("path")
Pretty simple.

The tricky part is that at some point it started popping an error message for option 2 saying it coulnd't create the folder because it already existed, but there wasn't any folder. Moreover, once I tried to delete the main folder where I as saving these folders it turned out I can't and Windows pops the following error message:

An unexpected error is keeping you from deleting the folder. if you continue to receive this eror, you can use the code to search for help with this problem.

Error 0x80070091: The directory is not empty
But it's empty! It seems the one way to delete this folder is to do it in safe mode. Was this caused by the createfolder method? Thank you in advance.

Regards,

Samuel