ExcelScript.ProtectionSelectionMode enum
Remarks
Examples
/**
* This script protects cells from being selected on the current worksheet.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the protection settings for the current worksheet.
const currentSheet = workbook.getActiveWorksheet();
const sheetProtection = currentSheet.getProtection();
// Create a new WorksheetProtectionOptions object with the selectionMode property set to `none`.
let protectionOptions : ExcelScript.WorksheetProtectionOptions = {
selectionMode: ExcelScript.ProtectionSelectionMode.none
}
// Apply the given protection options.
sheetProtection.protect(protectionOptions);
}
Fields
none | Selection is not allowed for any cells. |
normal | Selection is allowed for all cells. |
unlocked | Selection is allowed only for cells that are not locked. |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Scripts
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for