I have a workbook which I want to protect before closing it
using password 1 for example then save the workbook and finally close it
I have a code but needs to be refined - I think - as I got error
Code:Application.DisplayAlerts = False
ThisWorkbook.Password = "1"
ThisWorkbook.Save
Application.DisplayAlerts = True
ThisWorkbook.Saved = True
ThisWorkbook.Close