Learn Excel - Simplify Life with Excel Concepts

Excel MkDir Function (VBA)

MkDir Function VBA Code

How to use the MkDir Function (VBA)

This Excel tutorial explains how to use the Excel MkDir function with syntax and examples using VBA.

SUMMARY:

The Excel VBA MkDir function allows you to creates a new directory or folder.

PURPOSE:

To create a new folder or directory.

RETURN VALUE:

The MkDir function does not return a value, but rather creates a new folder or directory.

SYNTAX:

MkDir path

ARGUMENTS:

The MkDir function syntax has the following arguments:

  • path: Required. The pathname argument is 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.

REMARKS:

  • If the specified folder or the directory already exists, the function returns an error.
  • This function will not create multiple subfolders.
  • If you want to create subfolders you must create the top level folders first and then create the subfolders with a subsequent procedure call.

Useful Links: Link 1Link 2Link 3Link 4