I have a worksheet that receives data from an external software through a DDE link. When I run a macro, Excel imports different type of values which are stored in multiple cells, the problem is that these values in the cells keep updating, slowing everything down. Can I force Excel to stop receiving data from the DDE link?
I tried to put Application.DDETerminateAll at the end of the code with no success.
This is the part of the macro where i trigger the DDE update :
I tried to put Application.DDETerminateAll at the end of the code with no success.
This is the part of the macro where i trigger the DDE update :
VBA Code:
LIVE.Activate
Set rng = Sheets("monitor").Range("B11:B500")
For Each c In rng
If c = "" Then
Exit For
End If
code = Range("B" & c.Row)
bid = "=BrokerINFO|'VIRTUAL:Virtual_SecOrderDepth'!'VIRTUAL_SECORDERDEPTH_RENDER.BestBuyPx(0,MCW," & code & ")'"
Range("C" & c.Row) = bid
ask = "=BrokerINFO|'VIRTUAL:Virtual_SecOrderDepth'!'VIRTUAL_SECORDERDEPTH_RENDER.BestSellPx(0,MCW," & code & ")'"
Range("D" & c.Row) = ask
bquant = "=BrokerINFO|'VIRTUAL:Virtual_SecOrderDepth'!'VIRTUAL_SECORDERDEPTH_RENDER.TotalQtyDisplayedBuyPx(0,MCW," & code & ")'"
Range("F" & c.Row) = bquant
aquant = "=BrokerINFO|'VIRTUAL:Virtual_SecOrderDepth'!'VIRTUAL_SECORDERDEPTH_RENDER.TotalQtyDisplayedSellPx(0,MCW," & code & ")'"
Range("G" & c.Row) = aquant
RefPrice = "=BrokerINFO|'VIRTUAL:Virtual_BestPrice'!'EXTRA_SECURITY_BESTPRICE_RENDER.PrevReferencePx(MCW," & code & ")'"
Range("I" & c.Row) = RefPrice
bideq = "=BrokerINFO|'VIRTUAL:Virtual_SecOrderDepth'!'VIRTUAL_SECORDERDEPTH_RENDER.BuyMarketMakerFlag(0,MCW," & code & ")'"
Range("N" & c.Row) = bideq
askeq = "=BrokerINFO|'VIRTUAL:Virtual_SecOrderDepth'!'VIRTUAL_SECORDERDEPTH_RENDER.SellMarketMakerFlag(0,MCW," & code & ")'"
Range("O" & c.Row) = askeq
controllo = "=BrokerINFO|'VIRTUAL:Virtual_BestPrice'!'EXTRA_SECURITY_BESTPRICE_RENDER.ControlPx(MCW," & code & ")'"
Range("P" & c.Row) = controllo
Next
Application.DDETerminateAll
End Sub