Visual Basic Language Reference  

MkDir Function

Creates a new directory or folder.

Public Sub MkDir(ByVal Path As String)

Parameter

Path
Required. 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.

Exceptions/Errors

Exception type Error number Condition
ArgumentException 52 Path is not specified or is empty.
IOException 75 Directory already exists.

Example

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

MkDir("C:\MYDIR")   ' Make new directory or folder.

See Also

ChDir Function | CurDir Function | RmDir Function | ArgumentException| IOException