Peter Davison
Active Member
- Joined
- Jun 4, 2020
- Messages
- 433
- Office Version
- 365
- Platform
- Windows
I cannot get the following code to do just a simple save as cell value it just comes up with an error on the ActiveWorkbook.SaveAs line. I can't think what I am doing wrong? Any help will be appreciated.
Private Sub CommandButton1_Click()
Dim Path As String
Dim filename1 As String
Path = "C:\"
filename1 = Range("d6").Value
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Path & filename1 & ".xlsm", FileFormat:=52
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
Private Sub CommandButton1_Click()
Dim Path As String
Dim filename1 As String
Path = "C:\"
filename1 = Range("d6").Value
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Path & filename1 & ".xlsm", FileFormat:=52
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub