MkDir Statement |
Named Arguments
No
Syntax
MkDir path
path
Use: Required
Data Type: String
The name of the folder to be created.
Description
Creates a new folder.
Rules at a Glance
If you omit the drive from path, a new folder is created on the current drive.
You can specify the drive using either its local drive letter or its UNC name.
Programming Tips and Gotchas
If your program is running on Windows NT, ensure that the logged-in user has the rights to create a folder on the specified drive prior to calling the MkDir statement.
VB doesn't make the new folder the current folder automatically after a call to MkDir. You need to call the ChDir statement to do this.
To remove a folder, use the RmDir statement.
Use CurDir to determine the current drive.
VB6 includes a new File System object model that has a Folders collection object and Folder object. You will find these objects much more flexible and easier to use than the intrinsic VB folder-management functions.
See Also
- ChDir Statement, CurDir Function, File System Objects, RmDir Statement
Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.