Vba code to password protect workbook in Excel
I am trying to add a command button that will set a custom view, password protect all worksheets, and finally password protect the entire workbook structure. The code I am using will correctly set the view and add the password to the worksheets, but it will not apply the password to the workbook structure. What do I need to add?
According to Microsoft Help use
ActiveWorkbook.Protect Password:="test", Structure:=True, Windows:=True
(for formulas, depending on your country, you might have to change ; with , or the opposite