Outlook) (Table.EndOfTable 屬性
會傳回 Boolean,指出目前列是否位在 Table 物件的最後一列之後。 唯讀。
語法
expression。 EndOfTable
表達 代表 Table 物件的變數。
註解
當您使用 Folder.GetTable、Search.GetTable 或 Table.Restrict 開啟 Table 時,EndOfTable 的值會取決於 Table 中的列數。 如果沒有資料列, EndOfTable 會 傳回 True。 如果有資料列, EndOfTable 會 傳回 False ,直到游標移到 Table 中的最後一個資料 列之後。
Table 有兩個虛擬 Null 列,一個在第一列之前,另一個在 Table 中的最後一列之後。 每次呼叫 Table.GetNextRow 都會將目前的資料列移至 Table 中的下一個資料列,並傳回代表目前資料列的 Row 物件。
如果目前列是在最後一列之後,EndOfTable 屬性會傳回 True,如果目前列是在最後一列上或之前,則會傳回 False。
範例
在下列程式碼範例中,會在 [收件匣] 的項目上套用 Jet 篩選,取得項目的 LastModificationTime 在 2005 年 11 月 1 日之前的 Table。 然後使用 EndOfTable 屬性列舉 Table 中的項目,並列印 Table 中每個項目的預設屬性值。
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 November 1, 2005
Filter = "[LastModificationTime] > '11/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("EntryID"))
Debug.Print (oRow("Subject"))
Debug.Print (oRow("CreationTime"))
Debug.Print (oRow("LastModificationTime"))
Debug.Print (oRow("MessageClass"))
Loop
End Sub
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。