VB and VBA Users Source Code: Create a directory structure using an API call
[
Home
|
Contents
|
Search
|
Reply
|
Previous
| Next ]
VB/VBA Source Code
Create a directory structure using an API call
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Thursday, June 21, 2001
Hits:
916
Category:
Files/Directories/IO
Article:
The following code creates a directory structure using an API call: Option Explicit Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal lpPath As String) As Boolean 'Purpose : Creates all the directories in the specified path, beginning with the root. 'Inputs : sPathToCreate The path to create 'Outputs : Returns True on success 'Author : Andrew Baker 'Date : 25/05/2001 'Notes : Each directory specified is created, if it does not already exist. ' If only some of the directories are created, the function will return FALSE. Function MkDirEx(sPathToCreate As String) As Boolean On Error GoTo ErrFailed MkDirEx = MakeSureDirectoryPathExists(sPathToCreate) Exit Function ErrFailed: Debug.Print Err.Description MkDirEx = False End Function Sub Test() If MkDirEx("C:\Test\If\It\Created\This\Directory\Structure") Then MsgBox "Created directory structure" End If End Sub
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder