HI,
I have a macro workbook which is used to search a term in multiple worksheets at a time (using filter options). I want to restrict users from using the "Save" and "Save as" option from excel. I would like only few people to alter and save. Hence require password protected save option. I have attached the couple of codes that I was using, which was working fine previously; but now the code no longer works. Please help. Thank you.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim xName As String
xName = "CancelBeforeSave"
If Not Evaluate("=ISREF('" & xName & "'!A1)") Then
Sheets.Add(after:=Worksheets(Worksheets.count)).Name = xName & ""
Sheets(xName & "").Move after:=Worksheets(Worksheets.count)
Sheets(xName & "").Visible = False
Exit Sub
End If
Cancel = True
End Sub
Bookmarks