Excel ActiveSheet.Protect 的属性

来源:互联网 发布:cat linux 大文件 编辑:程序博客网 时间:2024/05/16 08:13

Excel ActiveSheet.Protect

 

DrawingObjects:=False,               能编辑对象

Contents:=True,                            内容

Scenarios:=False,                        能编辑方案

AllowFormattingCells:=True,          格式化单元格

AllowFormattingColumns:=True,   格式化列

AllowFormattingRows:=True,        格式化行

AllowInsertingColumns:=True,      插入列

AllowInsertingRows:=True,            插入行

AllowInsertingHyperlinks:=True,     插入超链接

AllowDeletingColumns:=True,        删除列

AllowDeletingRows:=True,            删除行

AllowSorting:=True,                       排序

AllowFiltering:=True,                      筛选

AllowUsingPivotTables:=True          透视表

password:="123"                           设置密码

另:

ActiveSheet.EnableSelection = xlUnlockedCells     只选未锁定单元格

ActiveSheet.EnableSelection = xlNoSelection       只选锁定单元格

 

EnableSelection   Remarks

This property takes effect only when the worksheet is protected:

xlNoSelection prevents any selection on the sheet,

xlUnlockedCells allows only those cells whose Locked property is False to be selected,

and xlNoRestrictions allows any cell to be selected.

Example

This example sets worksheet one so that nothing on it can be selected.

With Worksheets(1)    .EnableSelection = xlNoSelection    .Protect Contents:=True, UserInterfaceOnly:=TrueEnd With

 

原创粉丝点击