Forum Discussion

Jaron Rosegg's avatar
Jaron Rosegg
Copper Contributor
Jan 26, 2018
Solved

Office 365 - Delete data connections in one go

Hi all, first post here as recommended by Philip Pio from Microsoft (https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_win10-mso_365hp/office-365-delete-connections-in-one-go/3011...
  • Pablo R. Ortiz's avatar
    Feb 04, 2018

    you can use this vbscript in a Macro button:

     

    Sub Remove()
    Dim connection As WorkbookConnection
    Dim query As WorkbookQuery
    On Error Resume Next
    For Each connection In ThisWorkbook.Connections
        connection.Delete
    Next
    For Each query In ThisWorkbook.Queries
        query.Delete
    Next
    End Sub