Create a TWS Toolbar in Excel®

The sample spreadsheet includes macros for adding tickers, requesting market data and submitting orders. The existing "Toolbar" is actually linked to the spreadsheet cells, so if you want to minimize some of the columns, it's likely that some of your toolbar buttons will become unreadable and perhaps unusable.

As an alternative, you can create your own custom  toolbar and put the API commands on it. This toolbar will act like the native Excel toolbars, and be movable and dockable, so it won't be affected if you modify the spreadsheet layout.

To create an Excel toolbar

  1. On the View menu select Toolbars and then select Customize.

  2. In the Customize window click the Toolbars tab and then click New.

  3. In the New Toolbar window, type a toolbar name and click OK.

The new and empty toolbar appears on your Excel screen to the right of the Customize window. To add action buttons to the toolbar, continue with the procedure below.

To add action (macros) buttons to an Excel toolbar

  1. From the Tools menu select Customize.

  2. In the Customize window, click the Commands tab.

  3. Scroll down the Categories list and select Macros.

  4. In the Commands list, click and drag Custom Menu Item onto the new toolbar.

  5. In the Customize window, click Modify Selection and then click Assign Macro.

  6. In the list of macros, select the macro that you want to assign to the toolbar button and click OK.

  7. In the Customize window, again click Modify Selection.

  8. In the Name text field, enter a button name for the macro you just assigned and press Enter. The table below describes our macros and tells you their assigned name on the API toolbar.

  9. Repeat Steps 3-7 above to assign a toolbar button for each macro. When you have finished, click Close.



Button Name


Cancels the market depth request for the selected line.



Sends a cancellation request on a working order.












Creates a new ticker row using information you enter in the Ticker window.

Add Ticker


Resubmits an order after you have modified the quantity, order type, limit price or auxiliary price.



Transmits an order to the destination you defined in the Exchange field.



Requests ask, bid and last price market data for the selected underlying.

Get Market Data


This macro includes sample VB® code for creating trade-related programs. Do not include this macro on your toolbar.



This macro includes VB code for creating conditional orders. Fields are found on the Conditional Orders worksheet. Do not include this macro on your toolbar.


To view or hide Excel toolbars

  1. On the View menu, click Toolbars.

  2. Check a toolbar name to display it; de-select a toolbar name to hide it.