• C#
  • Java
  • VB
  • C++
  • Python
Contact us
Receiving the Data - Add a Button

In this step, you will add a button to your blank worksheet which, once the TWS has replied to your historical data request with the “RECEIVED” status, will help you manually invoke the VBA routines which pull the historical data from TWS.

First, open the Developer tab in Excel and click on the Button form control:

dde_hst_add_a_button_1.png

Next, click anywhere in your spreadsheet to place the button. The Assign Macro dialog opens; this is where you associate a VBA macro with your button. Name your function fetchHistoricalData and then click the New button in the dialog.

dde_hst_add_a_button_2.png

Excel automatically opens the VBA editor, which displays the skeleton of the newly-created macro.

dde_hst_add_a_button_3.png

In the next step, you will add the code to the macro you just created.