This is what I have just done with the above code...
This website has more info..
http://www.techonthenet.co
[quote]If path is a complex directory structure, the high-level directories must already exist or the MkDir statement will raise an error.
For example, if you executed the following code:
MkDir "c:\Test\Access"
The c:\Test directory must already exist. The MkDir statement will only attempt to create the Access directory under the c:\Test directory. It will not create the c:\Test directory itself.
[/quote]
Private Sub Command110_Click()
Dim imgPath As String
Dim companyPath As String
imgPath = "V:\Company_Files\" & Me.Company.Value & "\images"
companyPath = "V:\Company_Files\" & Me.Company.Value
'If full path exists then open directory
If Dir(imgPath, vbDirectory) > vbNullString Then
Shell "C:\WINDOWS\explorer.exe """ & imgPath & "", vbNormalFocus
Exit Sub
End If
' If company folder exists but no documents folder
' Create document folder and open
If Dir(companyPath, vbDirectory) > vbNullString Then
MkDir "V:\Company_Files\" & Me.Company.Value & "\images"
Shell "C:\WINDOWS\explorer.exe """ & imgPath & "", vbNormalFocus
End If
'If company folder does not exisit
'Create company folder and then create documents folder
'And then open
If Dir(companyPath, vbDirectory) = vbNullString Then
MkDir "V:\Company_Files\" & Me.Company.Value
MkDir "V:\Company_Files\" & Me.Company.Value & "\images"
Shell "C:\WINDOWS\explorer.exe """ & imgPath & "", vbNormalFocus
End If
End Sub
Main Topics
Browse All Topics





by: GijimaAstPosted on 2007-11-08 at 07:54:25ID: 20242198
Sub MakeFolder(strPath As String)
If Dir(strPath, vbDirectory) > vbNullString Then
Exit Sub
End If
MkDir strPath
End Sub