title: Refresh All Queries in Workbook
body: <p>This works for .xls books, but can it be altered for .xlsx workbooks as well?  Or is their syntax that will work for both?  </p>
  
  <pre><code>Option Explicit
  Public Sub RefreshQueries()
    Dim wks As Worksheet
    Dim qt As QueryTable
    For Each wks In Worksheets
      For Each qt In wks.QueryTables
          qt.Refresh BackgroundQuery:=False
      Next qt
    Next wks
    Set qt = Nothing
    Set wks = Nothing
  End Sub
  </code></pre>
  
  <p>EDIT --
  So it seems my syntax does refresh .xlsx workbooks, but not queries that are from sql server.  How can those be refreshed via VBA.</p>