Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.1
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
Statistic
FMM
Blog
Protects/unprotects the sheet.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
XL | 3.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
bookRef | The reference to the workbook. Please use XL.LoadBook to load a file. | $ref |
sheetIndex | The index of the sheet. This number ranges from 0 to XL.Book.SheetCount-1. | 0 |
Value | The new setting. | 1 |
Returns OK or error message.
Protect the 3rd sheet:
MBS( "XL.Sheet.SetProtect"; $book; 2; 1)
Write cell locked and protect sheet:
# create format
Set Variable [ $lockFormat ; Value: MBS( "XL.Book.AddFormat"; $book) ]
Set Variable [ $r ; Value: MBS( "XL.Format.SetLocked"; $book; $lockFormat; 1) ]
# add sheet
Set Variable [ $sheet ; Value: MBS( "XL.Book.AddSheet"; $book; "test") ]
# and write a locked cell
Set Variable [ $r ; Value: MBS( "XL.Sheet.CellWriteText"; $book; $sheet; 5; 5; "Locked text"; $lockFormat) ]
# protect sheet
Set Variable [ $r ; Value: MBS( "XL.Sheet.SetProtectEx"; $book; $sheet; 1; "test"; "all") ]
This function checks for a license.
Created 18th August 2014, last changed 7th September 2022