MkDir (statement)


MkDir dir$


Creates a new directory as specified by dir$.


This example creates a new directory on the default drive. If this causes an error, then the error is displayed and the program terminates. If no error is generated, the directory is removed with the RmDir statement.

Sub Main()
  On Error Resume Next
  MkDir "testdir"
  If Err <> 0 Then
    MsgBox "The following error occurred: " & Error(Err)
    MsgBox "Directory 'testdir' was created and is about to be removed."
    RmDir "testdir"
  End If
End Sub

See Also

ChDir (statement); ChDrive (statement); CurDir, CurDir$ (functions); Dir, Dir$ (functions); RmDir (statement).

More information