title: vba excel connections query tables delete
body: <p>in a bigger Excel application, (25 sheets, 50 command-buttons, 5000 lines of code, 18 userforms ... size 12 MB) ... we load tables from a server as txt files and reconvert these txt_files to excel data with the standard procedure.
  By macro we delete all querytables and connections after the downloads.</p>
  
  <p>Everything worked perfect and quick, but the main sheet is getting slower and slower now.
  Even opening the Workbook takes more and more time, while the size remains constant.</p>
  
  <p>Somehow I have the feeling, there are remainings of the data transfer from the txt_files which are not deleted with:</p>
  
  #
  
  <pre><code>Dim ws As Worksheet   
  Dim qt As QueryTable   
  For Each ws In ThisWorkbook.Worksheets   
  For Each qt In ws.QueryTables   
  qt.Delete   
  Next qt   
  Next ws   
  
  If ActiveWorkbook.Connections.Count &gt; 0 Then   
  For i = 1 To ActiveWorkbook.Connections.Count   
  ActiveWorkbook.Connections.Item(1).Delete   
  Next i 
  EndIf
  </code></pre>
  
  #
  
  <p>There are no formulas in the workbook. 
  The slowing down persists, even selecting all cells of the main_sheet + clear ... I suppose all cells are empty after that command...</p>
  
  <p>In the other 24 Sheets there are no speed_problems (even filtering a List 850.000 x 33)</p>
  
  <p>Any idea how to check what is slowing down the Workbook in the main_sheet?
  Are there more powerful 'cleanup'commands then deleting querytables and connections?
  Are there any methods to log what is excel doing, while it does not return the command?</p>