共用方式為


Outlook) (Row.Item 方法

取得Object,代表位於Index 所指定資料行之Row物件的值。

語法

運算式專案 (索引)

表達 代表 Row 物件的變數。

參數

名稱 必要/選用 資料類型 描述
Index 必要 Variant 以 1 起始的索引值,可以是代表Columns集合之資料行索引的Long,或是代表資料行名稱String

傳回值

Variant,代表屬性的值, (如 (父資料) 所指定的專案索引) 所指定。

註解

Item 方法是 Row 物件的預設方法,表示您可以隱含使用此方法。 下列兩行程式碼都會存取Table中指定資料Subject屬性值:

Row.Item("Subject")

Row("Subject")

如果 Column 已經使用參照命名空間的屬性名稱加入至 Table,您就必須依相同的命名空間參照,在 Row.Item 方法中參照 Column。 如果您在 Row.Item中使用明確的內建名稱參考,您會收到錯誤。

範例

在下列程式碼範例中,會說明如何根據 [收件匣] 中項目的 LastModificationTime,取得 Table 物件。 然後,範例還會列舉並列印這些項目的一些預設屬性值。 由於 Item 方法是 Row 物件的預設方法,因此會以隱含方式使用 Item 方法。

Sub DemoTable() 
 'Declarations 
 Dim Filter As String 
 Dim oRow As Outlook.Row 
 Dim oTable As Outlook.Table 
 Dim oFolder As Outlook.Folder 
 
 'Get a Folder object for the Inbox 
 Set oFolder = Application.Session.GetDefaultFolder(olFolderInbox) 
 
 'Define Filter to obtain items last modified after May 1, 2005 
 Filter = "[LastModificationTime] > '5/1/2005'" 
 'Restrict with Filter 
 Set oTable = oFolder.GetTable(Filter) 
 
 'Enumerate the table using test for EndOfTable 
 Do Until (oTable.EndOfTable) 
 Set oRow = oTable.GetNextRow() 
 Debug.Print (oRow("Subject")) 
 Debug.Print (oRow("LastModificationTime")) 
 Loop 
End Sub

另請參閱

Row 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應