vba create folder if not exist vba create directory if not exist

The solution for “vba create folder if not exist vba create directory if not exist” can be found here. The following code will assist you in solving the problem.

‘requires reference to Microsoft Scripting Runtime
Function MkDir(ByVal strDir As String, ByVal strPath As String)
Dim fso As New FileSystemObject
Dim path As String
path = strPath & strDir
If Not fso.FolderExists(path) Then
fso.CreateFolder path
End If
End Function’Don’t requires refernce of Microsoft Scripting Runtime
Path = “D:\FolderName\”
If Len(Dir(Path, vbDirectory)) = 0 Then
MkDir Location
End If

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts