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.


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


To create a new folder or directory.


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


MkDir path


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.


  • 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