Arie Bos
Board Regular
- Joined
- Mar 25, 2016
- Messages
- 224
- Office Version
- 365
- Platform
- Windows
I want to create a folder in below 'Sales' folder, named after the text value located in a cell named 'CompanyName'. So if the company name in that cell is XYZ, I want to have the new folder created in 'Sales' called XYZ. I am missing something here, but can't see where or what...
VBA Code:
Public Function vDir() As String
vDir = Environ("userprofile") & "\Documents\Soniq\Sales\" & Range("CompanyName") & "\"
End Function
Sub ProjectFolder()
Dim vDir As String, NewFldr3 As String
NewFldr3 = Range("CompanyName")
If Dir(vDir & NewFldr3, vbDirectory) = "" Then
MkDir vDir & NewFldr3
End If
End Sub
Last edited: