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?
GetRowCount method corresponds to the IMAPITable::GetRowCount method which explains possible reasons like memory constraints and etc. You may find the following description helpful:
GetRowCountto find out how many rows a table holds before making a call to the
IMAPITable::QueryRowsmethod to retrieve the data. If there are less than twenty rows in the table, it is safe to call
QueryPositionto retrieve the whole table. If there are more than twenty rows in the table, consider making multiple calls to
QueryPositionand limit the number of rows retrieved in each call.
Some tables do not support GetRowCount and return
GetRowCountis not supported, an alternative might be to call
IMAPITable::QueryPosition. With the results from
QueryPosition, you can determine the relationship between the current row and last row.
GetRowCountreturns MAPI_E_BUSY because it is temporarily unable to retrieve a row count, call the
WaitForCompletionreturns, retry the call to
GetRowCount. Another way to detect whether an asynchronous operation is in progress is to call the
IMAPITable::GetStatusmethod and check the contents of the
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.