View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Create Folders From Excel

You can play with this

Sub MakeDirectory()
Dim Dirname As String
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Dirname = "C:\MyDir"
If Not fs.FolderExists(Dirname) Then
fs.CreateFolder Dirname
Else
' do nothing
End If
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"WBTKbeezy" wrote in message ...
I have some code that saves several copies of a spreadsheet to a specific
folder and it works great. However, if the folder that is specified in the
code doesn't exist, it errors out. Is there a way to have the folders be
created via VB code to circumvent this? I have to create folders on a daily
basis, and this would save some annoyance.