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


Discover more from dotNetTips.com

Subscribe to get the latest posts sent to your email.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.