Sub Maybe_2()
Dim newName As String, wb As Workbook, sh As Worksheet
Set wb = ThisWorkbook
newName = ThisWorkbook.Path & "\" & Left(wb.Name, InStrRev(wb.Name, ".") - 1) & Year(Now) & Format(Month(Now), "00") & Format(Day(Now), "00") '& ".xlsx" ', FileFormat:=51
wb.Worksheets.Copy
For Each sh In ActiveWorkbook.Worksheets
sh.UsedRange.Value = sh.UsedRange.Value
sh.Protect Password:="ABC"
Next sh
With ActiveWorkbook
.SaveAs newName & ".xlsx", 51
.Close True
End With
End Sub
Sub Maybe_2()
Dim newName As String, wb As Workbook, sh As Worksheet
Set wb = ThisWorkbook
newName = ThisWorkbook.Path & "\" & Left(wb.Name, InStrRev(wb.Name, ".") - 1) & Year(Now) & Format(Month(Now), "00") & Format(Day(Now), "00") '& ".xlsx" ', FileFormat:=51
wb.Worksheets.Copy
For Each sh In ActiveWorkbook.Worksheets
If sh.ProtectContents = True Then sh.Unprotect
sh.UsedRange.Value = sh.UsedRange.Value
Next sh
With ActiveWorkbook
.SaveAs newName & ".xlsx", 51
.Close True
End With
End Sub
Sub Maybe_2()
Dim newName As String, pw As String, wb As Workbook, sh As Worksheet
Set wb = ThisWorkbook
pw = InputBox("Password Here") '<---- Change required
newName = ThisWorkbook.Path & "\" & Left(wb.Name, InStrRev(wb.Name, ".") - 1) & Year(Now) & Format(Month(Now), "00") & Format(Day(Now), "00") '& ".xlsx" ', FileFormat:=51
wb.Worksheets.Copy
For Each sh In ActiveWorkbook.Worksheets
sh.Unprotect pw
sh.UsedRange.Value = sh.UsedRange.Value
Next sh
With ActiveWorkbook
.SaveAs newName & ".xlsx", 51
.Close True
End With
End Sub
For Each sh In ActiveWorkbook.Worksheets
sh.Unprotect pw
sh.UsedRange.Value = sh.UsedRange.Value
sh.Protect pw
Next sh