Automatically refreshing a QTableView when data changed. When clicking on an item, the editor triggers the activeItem signal; the connected slot commitEditorData in turn raises the commitData signal with the editor in argument. So all my views use these custom delegate, editor, and data model.
I need assistance correcting my VBA code (below) to make it first update all query tables in the active workbook and then proceed to update all queries prior saving and closing. Currently everything is working except the query table updates.
Code:
Sub Auto_Open()
Workbooks.Open Filename:='c:test5.xls'
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim qt As QueryTable
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
For Each qt In ws.QueryTables
qt.BackgroundQuery = False
qt.Refresh
Next qt
Next ws
Call UpdateAllPivots
Application.ScreenUpdating = True
ActiveWorkbook.SaveAs Filename:='sharepoint.test.comsitestest2test3test4ReportsSummarytest5.xls'
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
Sub UpdateAllPivots()
Dim pt As PivotTable
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.RefreshTable
Next pt
Next ws
End Sub
Code:
Sub Auto_Open()
Workbooks.Open Filename:='c:test5.xls'
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim qt As QueryTable
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
For Each qt In ws.QueryTables
qt.BackgroundQuery = False
qt.Refresh
Next qt
Next ws
Call UpdateAllPivots
Application.ScreenUpdating = True
ActiveWorkbook.SaveAs Filename:='sharepoint.test.comsitestest2test3test4ReportsSummarytest5.xls'
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
Sub UpdateAllPivots()
Dim pt As PivotTable
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.RefreshTable
Next pt
Next ws
End Sub