FrontPage VBA教程:Required属性

返回或设置 Boolean 类型的值,该值确定域是否必选。如果域必选,则不能从当前列表将其删除。可读写。

expression.Required

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

VBA示例

下列示例显示当前列表中所有必选域的名称和默认值。如果不存在必选域,或者活动站点不包含列表,则向用户显示一条消息。


Sub DisplayRequiredFields()
'Displays the names and default values
'of all required fields in the first list of
'the web.
    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim objFields As ListFields
    Dim strReq As String
    Dim BlnFound As Boolean
    Set objApp = FrontPage.Application
    Set objFields = objApp.ActiveWeb.Lists.Item(0).Fields
    'set found flag to false
    BlnFound = False
    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objFields
             'If field is required, add to list
            If objField.Required = True Then
                If strReq = "" Then
                    'if first value in string
                    strReq = objField.Name & "  -  " & _
                    objField.DefaultValue & vbCr
                    'The list contains at least 1 required field
                    BlnFound = True
                Else
                    'add value to string
                    strReq = strReq & 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
    If BlnFound = True Then
        MsgBox "The current list contains the following required fields: " & _
               vbCr & strReq
    Else
        MsgBox "The current list contains no required field(s)."
    End If
End Sub

上页:FrontPage VBA教程:RecentFile属性 下页:FrontPage VBA教程:RevisionControlProject属性

FrontPage VBA教程:Required属性

FrontPage VBA教程:RevisionControlProject属性 FrontPage VBA教程:RootFolder属性
FrontPage VBA教程:RootNavigationNode属性 FrontPage VBA教程:scripts属性
FrontPage VBA教程:SelectedFiles属性 FrontPage VBA教程:SelectedFolders属性
FrontPage VBA教程:selection属性 FrontPage VBA教程:selectorText属性
FrontPage VBA教程:SharedBorders属性 FrontPage VBA教程:ShowAsPercentage属性
FrontPage VBA教程:ShowStartupDialog属性 FrontPage VBA教程:ShowUserNamesInResults属性
FrontPage VBA教程:SlowPage属性 FrontPage VBA教程:styleSheets属性
FrontPage VBA教程:SubTree属性 FrontPage VBA教程:SubViewMode属性
FrontPage VBA教程:System属性 FrontPage VBA教程:Template属性
FrontPage VBA教程:ThemeProperties属性 FrontPage VBA教程:Themes属性
版权所有 © 中山市飞娥软件工作室 证书:粤ICP备09170368号