I see, didn't check for the backslashes.....
Private Sub CommandButton1_Click()
Dim strFolderPath As String
Dim strFilePath As String
strFolderPath = CStr(Environ("HOMEDRIVE") & Environ("HOMEPATH")) & "\Booking forms"
If Dir(strFolderPath, vbDirectory) = vbNullString Then 'check if directory is already threre
MkDir strFolderPath 'if not, make dir
MsgBox "A folder has been created on your home drive . All room booking files will be saved to this folder.", vbInformation, "Folder Created"
End If
strFilePath = strFolderPath & "\TEST_FORM " & Format(Now, "dd-mm-yy hh-mm-ss") & ".xls"
ActiveWorkbook.SaveAs strFilePath
End Sub
Edit: Folder check adjusted...
Gerard
Bookmarks