ReadOnly 属性

       

返回 Boolean 类型的值,该值确定当前域是否具有只读权限。如果为 True,则用户不能修改此域。只读。

expression.ReadOnly

expression  必选。返回“应用于”列表中的对象之一的表达式。

示例

下列示例存储活动站点第一个列表中所有具有只读权限的域的名称和默认值。如果活动站点不包含列表,则向用户显示一条消息。

Sub FieldPermissions()
'Displays read/write permissions of all
'fields in the list.

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim objFields As listFields
    Dim strPerms As String

    Set objApp = FrontPage.Application
    Set objFields = objApp.ActiveWeb.Lists.Item(0).Fields

    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objFields
             'If field is read-only, add to list
             If objField.ReadOnly = True Then
                If strPerms = "" Then
                    'if first value in string
                    strPerms = objField.Name & "  -  " & _
                    objField.DefaultValue & vbCr
                Else
                    'add value to string
                    strType = strPerms & objField.Name & "  -  " & _
                    objField.DefaultValue & vbCr
                End If
             End If
        Next objField
    Else
        'display message to user
        MsgBox "The active web contains no lists."
    End If
End Sub