I found this in some old code
Code:
'---------------------------------------------------------------------------------------
' Procedure : MakeDir
' DateTime : 2005-06-28 10:20
' Author :
' Purpose : To make a Directory from within VBA. It checks if
' the Directory to be created already exists, and gives
' an Error message if so.
'
'Parameters:
'sDrive - the Drive on which the new directory is to be built
'sDir - the new directoryName
'
'Note: - Only creates 1 level per call
' - the sDir must have leading \ for each level of directory
' eg MakeDir "C" ,"\level1" <--call 1
' MakeDir "C" ,"\level1\level2" <--call 2
' will create c:\level1\level2 <--2 Calls required
'---------------------------------------------------------------------------------------
'
Sub MakeDir(sDrive As String, sDir As String)
On Error GoTo ErrorFound
VBA.FileSystem.MkDir sDrive & ":" & sDir
goto Exxit
ErrorFound:
If Err.Number = 75 Then
MsgBox "Err 75 - Directory (" & sDrive & ":" & sDir & ") already exists"
Else
MsgBox Err.Number & " other error " & Err.Description
End If
Exxit:
End Sub