JILBO
04-29-2021, 08:11 AM
Hi,
Wondering if anyone has figured out how delete specific queries in a workbook?
The below deletes all, but I want to remove a specific one as well before
Public Sub RemoveQueries()
'Removes all PowerQueries from Workbook
Dim cn As WorkbookConnection
Dim qr As WorkbookQuery
On Error Resume Next
For Each cn In ThisWorkbook.Connections
cn.Delete
Next
For Each qr In ThisWorkbook.Queries
qr.Delete
Next
End Sub
PS: See Post $4. st
Wondering if anyone has figured out how delete specific queries in a workbook?
The below deletes all, but I want to remove a specific one as well before
Public Sub RemoveQueries()
'Removes all PowerQueries from Workbook
Dim cn As WorkbookConnection
Dim qr As WorkbookQuery
On Error Resume Next
For Each cn In ThisWorkbook.Connections
cn.Delete
Next
For Each qr In ThisWorkbook.Queries
qr.Delete
Next
End Sub
PS: See Post $4. st