Quick question, I'm trying to save a file with the destination being defined in cell A1 (because the file can be located on different servers, depending on the user), plus the date it was saved. Could you please help me out? The VBA that I currently have is the following:
Sub Macro2()
'turn off pop-ups
Application.DisplayAlerts = False
Range("A15").Select
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:= _
Range("a1") & "CSI_ERE_1" & Today() & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = True
End Sub
I've had great results omitting FileFormat
when saving from XLSM to XLSX.
Try:
ActiveWorkbook.SaveAs Filename:= Range("A1").Value & "CSI_ERE_1" & Format(Date(), "dd.mm.yy") & ".xlsx"
And if that does not work:
ActiveWorkbook.SaveAs Filename:= Range("A1").Value & "CSI_ERE_1" & Format(Date(), "dd.mm.yy") & ".xlsx", FileFormat:=51
Using numerical fileformat has better backwards compatibility, and for some reason unknown to me, seems to be easier to use in general than the name constants.
List of fileformats and their numerical values: https://msdn.microsoft.com/en-us/library/office/ff198017.aspx