@cyiangou
I think there is error in this udf function
Can you guide us how to use it?
Just call it like this:
CreatePath "C:\folder1\folder2\folder3"
it should build all the levels if they don't exist.

Shouldn't this be a Sub and not a function? I can not get this to work
It's configured as a function if you want to get success/failure info from it, but just call it like a sub.

It should work perfectly. This particular proc I have used unchanged for almost 20 years (as evidenced by my 2 space indentation).