MkDir

Creates a new directory or folder.

Syntax: MkDir path

path
A string expression that identifies the directory or folder to be created. The path may include the drive. If no drive is specified, MkDir creates the new directory or folder on the current drive.

Common Errors

Error When
-2147467259 (&H80004005), Unspecified error path already exists, as a folder or as a file
the folder or drive that would hold path does not exist, or path is a zero-length string or a name a folder cannot have
94 (&H5E), Invalid use of Null path is Null

Note BETA 1034

When path already exists, as a folder or as a file, VB6 and 64-bit VBA raise error 75 (&H4B), Path/File access error, instead.

Note BETA 1034

When the folder or drive that would hold path does not exist, or path is a zero-length string or a name a folder cannot have, VB6 and 64-bit VBA raise error 76 (&H4C), Path not found, instead.

See Also

Example

This example uses the MkDir statement to create a directory or folder. If the drive is not specified, the new directory or folder is created on the current drive.

MkDir "MYDIR"   ' Make new directory or folder.