Using Excel 2016, I am trying to create a "save as" button and pull data from 3 cells to save the file. The problem is that cell S2 contains a date (which I need in the file name) but I can't seem to get it to work. When I test it and replace the date with text, it works. Can anyone help. Below is the code.
Thank You,
Private Sub CommandButton1_Click()
Dim Path As String
Dim FileName1 As String
Dim FileName2 As String
Dim FileName3 As String
Path = "\\teradump\TitleAttorneySupport\Pending New Approvals\"
FileName1 = Range("S2")
FileName2 = Range("F3")
FileName3 = Range("I2")
ActiveWorkbook.SaveAs Filename:=Path & FileName1 & "-" & FileName2 & "-" & FileName3 & ".xlsm", FileFormat:=52 End Sub
Thank You,
Private Sub CommandButton1_Click()
Dim Path As String
Dim FileName1 As String
Dim FileName2 As String
Dim FileName3 As String
Path = "\\teradump\TitleAttorneySupport\Pending New Approvals\"
FileName1 = Range("S2")
FileName2 = Range("F3")
FileName3 = Range("I2")
ActiveWorkbook.SaveAs Filename:=Path & FileName1 & "-" & FileName2 & "-" & FileName3 & ".xlsm", FileFormat:=52 End Sub