I am looking for help creating a commandbutton that, when clicked, saves the current file with a new name. I already have this part done but I have to go back into the file folder and delete the old version of the file. I am hoping it is possible to do this while it saves the new version of the file.
Private Sub CommandButton4_Click()
'ClearEmptyNQAD
With Application
.DisplayAlerts = False
.ScreenUpdating = False
.Calculation = xlCalculationAutomatic
.EnableEvents = False
End With
Dim ThisFile As String
ThisFile = Sheet8.Range("p46").Value
Application.Dialogs(xlDialogSaveAs).Show ThisFile & ".xlsm"
With Application
.DisplayAlerts = True
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
.EnableEvents = True
End With
End Sub
Cell P46 is a cell that groups other cells together to get a specific name. After a person selects a checkbox it adds 1 of a possible 3 different suffixes onto the filename and saves it. The way it is set up now I will end up with 4 files in the same folder that are just the same thing only updated. I want it to delete all older versions of the file whenever it updates.
Bookmarks