Dne 31.5.2022 v 17:32 Paul Newton napsal(a):
Hi all
I hope the following might be useful (I apologise if this is "old hat" for some of you). I wanted to create C:\Folder1\Folder2 when Folder1 does not exist.
fso = createobject('Scripting.FileSystemObject') fldr = fso.CreateFolder('C:\MyTest')
It is possible to do this using MKDIR but the created folders are in lowercase.
You cannot do this with the CreateDirectory API, nor with Scripting.FileSystemObject.
Here is the solution:
Function MDEx(tcFolder)
- tcFolder must be a full path including drive letter
DECLARE INTEGER SHCreateDirectory In Shell32 INTEGER hwnd, STRING Path Local nResult
- Path must be UNICODE
nResult = SHCreateDirectory(0, StrConv(tcFolder,5)) Return nResult && 0 = Success
Possible error codes are: ERROR_BAD_PATHNAME (161) : tcFolder was a relative path ERROR_FILENAME_EXCED_RANGE (206) : Path too long ERROR_FILE_EXISTS (80) or ERROR_ALREADY_EXISTS (183) : The directory already exists ERROR_CANCELLED (1223) : Cancelled by user
Paul Newton
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]