View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ryan Ryan is offline
external usenet poster
 
Posts: 124
Default Creating a new folder that does not already exsit.

I don't know what it is, I have tried multiple variations of this code and
still cannot get it to function.

Sub SaveAndClose1()
Path = "C:\Forms\F-50"
If Dir(Path, vbDirectory) = vbNullString Then
MkDir "C:\Forms\F-50"
End If
ActiveWorkbook.SaveAs Filename:="C:\Forms\F-50\" & Range("C6").Value &
Format(Date, "ddmmmyyyy") & ".xls"
'ActiveWorkbook.Close
End Sub

Attempting to to have a button that upon clicking will save the workbook to
C:\Forms\F-50. No computer that this will be used on will have this folders.
So they need to be created but if they have already done so, i want it just
to save there. Like I said I've used a lot of different variations and still
no go. Please Advise.

Your lovable stressed out intern.