> For the complete documentation index, see [llms.txt](https://algomaster.gitbook.io/tcore-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://algomaster.gitbook.io/tcore-api/excel-rtd-yu-vba/excel-vba-functions.md).

# Excel VBA functions

## 引用TCExcelLib

![](https://lh4.googleusercontent.com/m19cZefKxW8yMWDE7Ja1FSx8p8PAFVn3g0-E1aiCAQG9gxsBJCcKxLFUt-BlqoxN-e9xAIGZ_N_a5vqTdBfKIJJVFKFSZS8fJqei-V64wajI_CWQBChaiPKjURmoHQxx5zWsvHYi)

![](https://lh4.googleusercontent.com/PSkG7VL4aE_iaGpFpTHbfVNE3C5HpRYf3I3U8aKLqI2BwLDQfp5WLYSb4I8Yrz4IbNCvf63hpGNLcyHUvPP34uLdnXNQUtw1aKAtY0ee6W_klITJOFn-wuZV3iaUJwOT5TwqDamT)

## Initial TCExcelLib

```java
Public WithEvents m_eventSourceMain As TCExcelLib.TCExcelLibCom

Set m_eventSourceMain = New TCExcelLib.TCExcelLibCom
```

## Connect

连接

{% tabs %}
{% tab title="Request" %}

```csharp
int Connect(string SystemName);
```

| **Parameters** |           |
| -------------- | --------- |
| SystemName     | TCore系统名称 |
| {% endtab %}   |           |

{% tab title="Retrun" %}
大于0为成功，否则失败
{% endtab %}

{% tab title="Description" %}
Connect呼叫成功后，于callback [OnConnectionStatus](/tcore-api/excel-rtd-yu-vba/excellib-callbacks.md#onconnectionstatus)推送目前连线状态。
{% endtab %}
{% endtabs %}

## Logout

断开

```csharp
void Logout(string SystemName);
```

| **Parameters** |           |
| -------------- | --------- |
| SystemName     | TCore系统名称 |

## SendOrder

下单

{% tabs %}
{% tab title="Request" %}

```csharp
int SendOrder(string SystemName, string OrderInfo);
```

| **Parameters** |                                                                                                               |
| -------------- | ------------------------------------------------------------------------------------------------------------- |
| SystemName     | TCore系统名称                                                                                                     |
| OrderInfo      | [OrderInfo](/tcore-api/excel-rtd-yu-vba/excellib-can-shu-yu-hui-fu.md#can-shu-orderinfo-xia-dan-zi-liao)下单资料。 |
| {% endtab %}   |                                                                                                               |

{% tab title="Retrun" %}
成功为1，否则失败
{% endtab %}

{% tab title="Description" %}
SendOrder呼叫成功后，于callback OnExecutionReport推送主推回报。
{% endtab %}
{% endtabs %}

## DeleteOrder

删单

```csharp
void DeleteOrder(string SystemName, string reportID);
```

| **Parameters** |           |
| -------------- | --------- |
| SystemName     | TCore系统名称 |
| reportID       | 回报编号      |

## ReplaceOrder

改单

```csharp
void ReplaceOrder(string SystemName, string ReplaceInfo);
```

| **Parameters** |                                                                                                                   |
| -------------- | ----------------------------------------------------------------------------------------------------------------- |
| SystemName     | TCore系统名称                                                                                                         |
| ReplaceInfo    | [ReplaceInfo](/tcore-api/excel-rtd-yu-vba/excellib-can-shu-yu-hui-fu.md#can-shu-replaceinfo-gai-dan-zi-liao)改单资料。 |

## QueryAllInstrument <a href="#queryallinstrument" id="queryallinstrument"></a>

‌

查询全部合约列表Return

```
string QueryAllInstrumentInfo(string SystemName, string type);
```

| **Parameters** | ​Title                     |
| -------------- | -------------------------- |
| SystemName     | TCore系统名称                  |
| type           | Future or Options or Stock |

‌

## QueryInstrumentInfo <a href="#queryinstrumentinfo" id="queryinstrumentinfo"></a>

‌

查询合约资讯Return

```
string QueryInstrumentInfo(string SystemName, string symbol):
```

| **Parameters** | ​Title    |
| -------------- | --------- |
| SystemName     | TCore系统名称 |
| symbol         | 合约代码      |
