Sub NewWB()
Dim p As String, q As String, r As String
p = ActiveWorkbook.Path
q = Sheets("prof").Range("C5").Value
If Not DirExists(p & "\Output") Then MkDir (p & "\Output")
r = Dir(p & "\Output\" & q & "*")
If r <> "" Then Kill p & "\Output\" & r
ActiveSheet.Copy
With ActiveWorkbook
Application.DisplayAlerts = False
.SaveAs Filename:=p & "\Output\" & q & " " & Format(Now, "dd-mm-yy hh-mm") & ".csv", FileFormat:=xlCSV
Application.DisplayAlerts = True
.Close savechanges:=True
End With
End Sub
Function DirExists(SDirectory As String) As Boolean
If Dir(SDirectory, vbDirectory) <> "" Then DirExists = True
End Function