ListFieldCurrency |
包含关于用来查看列表中货币信息的域类型的信息。ListFieldCurrency 对象使您可以查看关于列表中货币域内不同货币类型的信息。
使用 ListFields.Item(index) 可以返回单个 ListFieldCurrency 对象,其中 index 是 fpListFieldCurrency 类型的域的名称或位置序号。
使用 ListFields.Add 方法可以将 fpFieldCurrency 类型的域添加到 ListFields 集合中。下列示例将名为 NewCurrencyField 的 fpFieldCurrency 类型的新域添加到 ListFields 集合中,并更改货币类型以显示加拿大元。
Sub CreateCurrencyField()
'Add new Currency field
Dim objApp As FrontPage.Application
Dim objLstFlds As ListFields
Dim objFldChoice As ListFieldCurrency
Dim strName As String
Set objApp = FrontPage.Application
Set objLstFlds = objApp.ActiveWeb.Lists.Item(0).Fields
strName = "NewCurrencyField"
'Add new Field of type fpFieldCurrency to list
objLstFlds.Add Name:=strName, Description:="New Currency Field", _
Fieldtype:=fpFieldCurrency, Required:=True
Set objFldChoice = objLstFlds.Item("NewCurrencyField")
'Change currency type to Canadian
objFldChoice.Currency = fpCurrencyFieldCanada
MsgBox "A new Field named " & strName & " was added to the list " & _
objApp.ActiveWeb.Lists.Item(0).Name & "."
End Sub