Cause a macro to run when a Cascade DataHub point changes value. Here is one macro that runs another macro every time a certain cell's value is updated by a DDE message. The macro that gets run is link_updated. It simply increments the value in cell A1. You can easily change this example to meet your needs. The set_link macro tells the workbook to run the link_updated macro whenever the DataHub sends a DDE message about point0001. You can also change the name of the DataHub point as needed.
Add to Sheet1 macro code:
--------------------------------------------------- Sub link_updated() Cells(1, 1) = Cells(1, 1) + 1 End Sub ---------------------------------------------------
Run once to establish the link:
--------------------------------------------------- Sub set_link() ThisWorkbook.SetLinkOnData "datahub|default!'point0001'", "Sheet1.link_updated" End Sub ---------------------------------------------------
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.