There are two ways to get data out of Excel and into the Cascade DataHub: by setting up a DDEAdvise loop to have the DataHub receive data automatically, or by using a DDEPoke command from a macro to write data to the DataHub manually. Here is a summary of the differences:
The DataHub can act as a DDE client and receive data automatically from Excel acting as a server.




![]() | If you want to link to a cell or range which is not on the first sheet in the workbook, you need to put the filename in square brackets, followed by the sheet name. For example:
|
![]() | Check the names in the Point Name and Domain columns. If either of them is not what you need, double-click it to select it, and change it. |
![]() | Although this an easy way to send data from Excel, it is not the most efficient when you have many data values to send. Each time any cell in the worksheet updates, all the values for all the cells connected to the DataHub get resent. Rather than having the DataHub act as a DDE client for many connected cells, we suggest using a range or the DDEPoke to send data instead (see below). |
![]() | When you save and close a spreadsheet connected to the Cascade DataHub, and then attempt to reopen it, you may get one or more messages, depending on your security settings in Excel, or other circumstances. Here's a summary of each message, and what to do:
|
The most flexible and efficient way to send data from Excel to the Cascade DataHub is by using DDEPoke from a macro. With DDEPoke you have complete control over when values get sent, and you can send the values for several data points at one time, which is explained in Additional Pointers. To activate the macro, it can be convenient to have a control button, which is explained in Add a Control Button.
'
' SendOutput Macro
'
Sub SendOutput()
mychannel = DDEInitiate("datahub", "default")
Application.Worksheets("Sheet1").Activate
Call DDEPoke(mychannel, "my_pointname", Cells(4, 3))
DDETerminate mychannel
End Sub![]() | Use the name of your data point from the Cascade DataHub for my_pointname. |
![]() | We use cell C4 in this example. If you need to use another cell, you will have to replace (4, 3) with the row and column numbers of the cell you wish to use. You can also name a range to send multiple values as an array. |
![]() | This explanation is illustrated in Section 5.1.2.2, “Add a Control Button”. We repeat the text briefly here. |
'
' Cascade Multiple Writeback macro
'
Sub Cascade_Writeback_Many()
mychannel = DDEInitiate("datahub", "default")
Application.Worksheets("variables").Activate
DDEPoke(mychannel, "pointname1", Cells(1,2))
DDEPoke(mychannel, "pointname2", Cells(2,2))
DDEPoke(mychannel, "pointname3", Cells(3,2))
DDEPoke(mychannel, "pointname4", Cells(4,2))
DDEPoke(mychannel, "pointname5", Cells(5,2))
DDEPoke(mychannel, "pointname6", Cells(6,2))
DDETerminate mychannel
End SubCopyright © 1995-2006 by Cogent Real-Time Systems, Inc. All rights reserved.