更新受保护工作表时出现连接问题

时间:2020-06-04 15:15:48

标签: excel vba powerquery

我正在尝试更新受保护工作表上的Power Query连接。但是,当我尝试调用connections_upd时,我不断收到错误400。

    Private Sub workbook_open()

        Dim ws As Worksheet
        Const Pwd = "123"

        For Each ws In Worksheets
            With ws
             .Protect Password:=Pwd, AllowFiltering:=True, UserInterfaceOnly:=True
            End With
        Next ws

    End Sub

    Private Sub connections_upd()

        For Each objConnection In ThisWorkbook.Connections
            objConnection.Refresh
        Next

    End Sub

您能帮我解决这个问题吗?

0 个答案:

没有答案