Just had another thought. Instead of using DDERequest every time SetLinkOnData triggers a macro, store links that were triggered in an array (have an array for all links and assign 1 if it was triggered) then wait until some time elapses after a last SetLinkOnData trigger (how long should one wait?) and then use DDERequest to pull in data for all those links that were triggered and reset the trigger array values for them to 0. So:
1) Populate worksheet cells with DDE links;
2) Assign the same macro âTriggerdLinksâ to all these links using SetLinkOnData method;
3) In TriggeredLinks macro, assign 1 to arrTriggeredLinks array element that corresponds to the link that triggered this macro;
4) In TriggeredLinks macro, set Windows API function SetTimer to trigger a macro âCheckForUpdatesâ in, say, 1ms, first cancelling previous settings for SetTimer. Thus if no other links set off TriggeredLinks macro via SetLinkOnData, CheckForUpdates macro will be called in 1ms after the last call to TriggeredLinks macro;
5) Once CheckForUpdates macro is called via SetTimer, use DDERequest to pull in data into a VBA array for all links that have corresponding element in the array arrTriggeredLinks set to 1 and then set these elements to 0.
Comments? Is 1ms to long to wait before calling DDERequest? Is there a way to find out how many DDE updates are stored in a queue, so that one doesnât have to use the Timer?
1) Populate worksheet cells with DDE links;
2) Assign the same macro âTriggerdLinksâ to all these links using SetLinkOnData method;
3) In TriggeredLinks macro, assign 1 to arrTriggeredLinks array element that corresponds to the link that triggered this macro;
4) In TriggeredLinks macro, set Windows API function SetTimer to trigger a macro âCheckForUpdatesâ in, say, 1ms, first cancelling previous settings for SetTimer. Thus if no other links set off TriggeredLinks macro via SetLinkOnData, CheckForUpdates macro will be called in 1ms after the last call to TriggeredLinks macro;
5) Once CheckForUpdates macro is called via SetTimer, use DDERequest to pull in data into a VBA array for all links that have corresponding element in the array arrTriggeredLinks set to 1 and then set these elements to 0.
Comments? Is 1ms to long to wait before calling DDERequest? Is there a way to find out how many DDE updates are stored in a queue, so that one doesnât have to use the Timer?