# TableInsert Method

> Inserts a new table with the given number of rows and columns at a text position or the input position and returns its table identifier, 0 or -1.

- **Product:** TX Text Control ActiveX
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Text Control ActiveX > API Reference > TXTextControl > TableInsert Method
- **448 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/tableinsert-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/tableinsert-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/tableinsert-method/llms-full.txt

---

This method inserts a new table in the text.

### Syntax

```vbscript
TXTextControl.TableInsert Rows, Columns, TextPos [, TableId]
```

### Parameters

| Parameter | Description |
|---|---|
| Rows | Specifies the number of rows. |
| Columns | Specifies the number of columns. |
| TextPos | Specifies the text position where the new table is to be inserted. It is inserted at the current input position when this parameter is set to -1. |
| TableId | Optional. Specifies a table identifier. This identifier can be used to access or to alter the table's text and attributes. It must be in the range of 10 to 32,767. |

### Return Value

| Value | Description |
|---|---|
| 0 | An error has occurred or the table could not be inserted. Tables cannot be inserted when text has been selected. |
| -1 | The new table has been inserted at the top or at the bottom of an existing table. In this case the new table is combined with the existing table. |
| otherwise | The table's identifier. This is the same value as specified with the TableId parameter or an internal identifier selected by Text Control when the optional TableId parameter has been omitted. |

### Data Types

| Name | Data type |
|---|---|
| Rows | Integer |
| Columns | Integer |
| TextPos | Long |
| TableId | Integer |
| Return value | Integer |

### See Also

- [Formatting Text by using Number Formats](https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables/number-formats/llms-full.txt)
- [Tables](https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables/llms-full.txt)
- [Using Formulas in Table Cells](https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables/formulas/llms-full.txt)
- [TableCanInsert Property](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/tablecaninsert-property/llms-full.txt)
- [TableDeleteLines Method](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/tabledeletelines-method/llms-full.txt)
- [Programming Category: Tables](https://docs.textcontrol.com/tx-text-control-activex/reference/categories/tables/llms-full.txt)

---

## Nearby

- **Previous:** [TableGridLines Property](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/tablegridlines-property/llms-full.txt)
- **Next:** [TableInsertColumn Method](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/tableinsertcolumn-method/llms-full.txt)
