# Function Reference

# _IETableGetCollection

Returns a collection object variable representing all the tables in a document or a single table by index

#include <IE.au3>
_IETableGetCollection ( ByRef $oObject [, $iIndex = -1] )

## Parameters

$oObject | Object variable of an InternetExplorer.Application, Window or Frame object
$iIndex | [optional] specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

## Return Value

Success: | an object collection of all tables in the document, @extended = table count.
Failure: | sets the @error flag to non-zero.
@error: | 3 ($_IEStatus_InvalidDataType) - Invalid Data Type 5 ($_IEStatus_InvalidValue) - Invalid Value 7 ($_IEStatus_NoMatch) - No Match
@extended: | Contains invalid parameter number

## Related

_IETableWriteToArray

## Example

### Example 1

    ; Open a browser with the table example, get a reference to the first table
    ; on the page (index 0) and read its contents into a 2-D array

    #include <Array.au3>
    #include <IE.au3>

    Local $oIE = _IE_Example("table")
    Local $oTable = _IETableGetCollection($oIE, 0)
    Local $aTableData = _IETableWriteToArray($oTable)

    _ArrayDisplay($aTableData)

    _IEQuit($oIE)

### Example 2

    ; Open a browser with the table example, get a reference to the
    ; table collection and display the number of tables on the page

    #include <IE.au3>
    #include <MsgBoxConstants.au3>

    Local $oIE = _IE_Example("table")
    Local $oTable = _IETableGetCollection($oIE)
    Local $iNumTables = @extended
    MsgBox($MB_SYSTEMMODAL, "Table Info", "There are " & $iNumTables & " tables on the page")

    _IEQuit($oIE)