Public Function delQuery() Dim wb As Workbook Set wb = ActiveWorkbook Dim q As WorkbookQuery For Each q In wb.Queries q.Delete NextEnd Function