返回或设置 Variant 类型的值,该值定义域的默认值。可读写。
expression.DefaultValue
expression 必选。返回“应用于”列表中的对象之一的表达式。
所有预填充域的默认值为“空”。
下列示例显示列表中所有域的名称以及与其相关联的默认值。如果活动站点不包含列表,则向用户显示一条消息。
Sub FieldDefaultValue()
'Display the default value of the field
Dim objApp As FrontPage.Application
Dim objField As ListField
Dim strType As String
Set objApp = FrontPage.Application
If Not ActiveWeb.Lists Is Nothing Then
'Display fields in first list of collection
For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
If strType = "" Then
'if first value in string
strType = objField.Name & " - " & _
objField.DefaultValue & vbCr
Else
'add value to string
strType = strType & objField.Name & " - " & _
objField.DefaultValue & vbCr
End If
Next objField
MsgBox "The names of the fields in this list and their default" & _
" values are: " & vbCr & strType
Else
'Otherwise display message to user
MsgBox "The current web contains no lists."
End If
End Sub