The Table object does not have a property count. Instead, it has the method GetRowCount. But that comes with the warning that it’s not reliable and may return an approximate count and yield an error.
Does anyone here know what’s different about the structure of a Table object that prevents VBA from knowing its count?
>Solution :
The GetRowCount method corresponds to the IMAPITable::GetRowCount method which explains possible reasons like memory constraints and etc. You may find the following description helpful:
Use
GetRowCountto find out how many rows a table holds before making a call to theIMAPITable::QueryRowsmethod to retrieve the data. If there are less than twenty rows in the table, it is safe to callQueryPositionto retrieve the whole table. If there are more than twenty rows in the table, consider making multiple calls toQueryPositionand limit the number of rows retrieved in each call.
Some tables do not support GetRowCount and return
MAPI_E_NO_SUPPORT. IfGetRowCountis not supported, an alternative might be to callIMAPITable::QueryPosition. With the results fromQueryPosition, you can determine the relationship between the current row and last row.
When
GetRowCountreturns MAPI_E_BUSY because it is temporarily unable to retrieve a row count, call theIMAPITable::WaitForCompletionmethod. WhenWaitForCompletionreturns, retry the call toGetRowCount. Another way to detect whether an asynchronous operation is in progress is to call theIMAPITable::GetStatusmethod and check the contents of thelpulTableStateparameter.
In Extended MAPI (a low-level API on which Outlook is based on) you can specify how many rows you would like to get using the IMAPITable::QueryRows method.