refresh both the External data source and pivot tables together within a time schedule

前端 未结 5 2050
感动是毒
感动是毒 2020-12-05 09:09

In my last post Auto refresh pivottables data in excel on first run, i found that on my first execution the query from the Externa

5条回答
  •  渐次进展
    2020-12-05 09:30

    I used the above answer but made use of the RefreshAll method. I also changed it to allow for multiple connections without having to specify the names. I then linked this to a button on my spreadsheet.

    Sub Refresh()
    
        Dim conn As Variant
    
        For Each conn In ActiveWorkbook.Connections
            conn.ODBCConnection.BackgroundQuery = False
        Next conn
    
        ActiveWorkbook.RefreshAll
    End Sub
    

提交回复
热议问题