A SheetProtection object contains sheet level protection properties that control what users can interact with when a worksheet is protected. To access SheetProtection, use Worksheet.SheetProtection.
The SheetProtection properties will only take effect if the worksheet is protected. Worksheets can be protected with Worksheet.Protect(String). If the worksheet is not protected, the values of the properties will persist, but will not have an effect.
//--- Open existing spreadsheet
ExcelApplication xla = new ExcelApplication();
Workbook wb = xla.Open(@"C:\MySpreadsheet.xlsx");
//--- Get SheetProtection
SheetProtection protection = wb[0].SheetProtection;
//--- Set Properties
protection.AllowFormatCells = true;
protection.AllowSort = false;
'--- Open existing spreadsheet
Dim xla As New ExcelApplication()
Dim wb As Workbook = xla.Open("C:\MySpreadsheet.xlsx")
'--- Get SheetProtection
Dim protection As SheetProtection = wb(0).SheetProtection
'--- Set Properties
protection.AllowFormatCells = true;
protection.AllowSort = false;