Pause DDE link from updating cells

Gnomo

New Member
Joined
Oct 6, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
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 :

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
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,215,446
Messages
6,124,895
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top