返回或设置 Boolean 类型的值,用来确定该域中的值是否以百分比显示。可读写。
expression.ShowAsPercentage
expression 必选。返回“应用于”列表中的对象之一的表达式。
以下示例将所有类型为 fpFieldNumber 的域的 ShowAsPercentage 属性设置为 True。这样,域中的值将以百分比显示。
注意 使用 ApplyChanges 方法来应用对列表所做的更改。
Sub DisplayAsPercentage()
'Displays all fields of type fpFieldNumber as
'a percentage
Dim objApp As FrontPage.Application
Dim objLstFlds As ListFields
Dim strName As String
Dim objLstFld As Object
Set objApp = FrontPage.Application
Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
'Cycle through lists and displays as a percentage
For Each objLstFld In objLstFlds
If objLstFld.Type = fpFieldNumber Then
objLstFld.ShowAsPercentage = True
End If
Next objLstFld
objApp.ActiveWeb.Lists.Item(0).ApplyChanges
End Sub