I have two annoyances in the macro below. The first is, I would like to append todays date at the end of the filename (mm-dd-yyyy). Everywhere I look online, I see a Format (Now or DateTime.Now). Whenever I run the command, I get a "Wrong number of arguments or invalid property assignment" error. I'm using Office 2010. The second issue is I would like for the file to be saved without any macros in it. I tried the Fileformat=51 option. It saves it with the macros disabled, but they are still there. Thanks for any help.
Code:
Sub Save_File()
Dim SaveName As String
Dim WSHShell As Object
Dim DesktopPath As String
Dim Today As String
' Today = Format(DateTime.Now(), "mm-dd-yyyy")
Set WSHShell = CreateObject("WScript.Shell")
DesktopPath = WSHShell.SpecialFolders("Desktop") & "\Data"
SaveName = ThisWorkbook.Worksheets("Data").Range("Z1").End(xlDown).Text & "_" & ThisWorkbook.Worksheets("Data").Range("Z2") & "_Comparison" & " " & Format(DateTime.Now(), "mm-dd-yyyy")
ActiveWorkbook.SaveAs DesktopPath & "\" & SaveName & ".xls"
Set WSHShell = Nothing
End Sub