Version 5 of How to launch a Tcl program from Excel

Updated 2004-12-21 20:42:09

Open a new Excel workbook. Use "View/Toolbars" to show the Forms toolbar. From the Forms toolbar, place a Button on the sheet. Give it the label, "Push me".

...


glennhalstead I have an example of Excel calling a Tcl script which creates a csv data file which is then loaded into excel as external data.

The path of the tcl script and the csv file that the tcl script is to craete are set in the spreadsheet cells.

When the 'update' button is clicked the Tcl script is executed then the external data table in the spreadsheet is updated.

It's not 100% automated but it's a good start.

There are still problems with error handling - e.g when you slect 'cancel' when selecting the csv file for the external data update.

To download go to [L1 ] and save demo.xls and demo.tcl to a local directory.

To run:

  • Open demo.xls
  • Change cells B23 and B24 to reflect the path where you stored the files
  • Click 'Update'
  • The tcl script is run, using the value of B23 as the path for the script and B24 as the name of the output file the script will create
  • - A message box is displayed confirming success or failure of the script
  • Click OK
  • A window appears where you select the file to be used to update the excel external reference
  • - Select the file created by the tcl script
  • The table in the spreadsheet is updated
  • -Note Row 1 is clock seconds so this should change each time