I've been trying different macros to get excel to save as the file with the current date as the filename to no avail. Currently the code I have in my Workbook is this.
My issue is that it just doesn't appear to do anything. Whenever I click SaveAs it just tries saving the file as its current name
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Range("aj23,ab15,ad14").Interior.ColorIndex = 4 Then
Cancel = False
ElseIf Range("aj23,ab15,ad14").Interior.ColorIndex <> 4 Then
Cancel = True
MsgBox "Please check that all orders are complete"
End If
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = False Then
Cancel = True
MsgBox "The 'Save' function for this workbook has " & Chr(10) & "been disabled. Please use 'Save As'.", vbOKOnly + vbInformation, "Save Disabled"
End If
End Sub
Sub Saveas()
Dim Filename
Sdate = " - " & Format(Date, "dd-mm-yyyy")
Filename = "Daily Orders"
ActiveWorkbook.Saveas Filename:=ActiveWorkbook.Path & "/" & Filename & Sdate & ".xlsx"
End Sub
My issue is that it just doesn't appear to do anything. Whenever I click SaveAs it just tries saving the file as its current name