title: Pause RTD server in Excel and save worksheet
body: <p>I have worksheet which gets data from RTD server through the following formula:</p>
  
  <pre><code>=RTD("tos.rtd", , "ASK", ".SPX150220C750")
  </code></pre>
  
  <p>I would like to save the worksheet with above formula every 1 minute or so. The challenge is to pause VBA code and also make sure that before we save, the value in the cell is updated. I have tried the following code.</p>
  
  <pre><code>Sub Archiving()
  For i = 0 To 4
  
      Worksheets("Test").Activate
      Application.Sheets("Test").Copy
      Application.DisplayAlerts = False
      ActiveWorkbook.SaveAs Filename:="D:\Save " &amp; i &amp; ".csv", FileFormat:=xlCSV
      ActiveWorkbook.Save
      ActiveWindow.Close
      Windows("Real time data.xlsm").Activate
      Application.DisplayAlerts = True
  
      Application.Wait (Now + TimeValue("0:00:05"))
  
      ActiveWorkbook.RefreshAll
      DoEvents
  Next i
  
  End Sub
  </code></pre>
  
  <p>The code does not work, simply because DoEvents waits until RTD is done with updates, which is never. I also have seen example where connection to DB is paused explicitly, but I don't know how to adapt it RTD server case. I tried to run RTD server from C#, but failed miserably. <a href="https://stackoverflow.com/questions/28390099/rtd-server-in-c-sharp-where-to-start/28390568#28390568">RTD in C# for dummies</a>
  Any suggestions?</p>