Create A Full Directory Path

Declare

Private Declare Function MakeSureDirectoryPathExists Lib "IMAGEHLP.DLL" 
(ByVal DirPath As String) As Long

Code

Public Sub CreatePath(ByVal DestPath As String)
    If Right(DestPath, 1) <> "\" Then
        DestPath = DestPath & "\"
    End If
    If MakeSureDirectoryPathExists(DestPath) = 0 Then
        MsgBox "Error creating path: " & DestPath
    End If
End Sub

 

Tip Submitted By: Kevin Buchan