ACross
07-02-2013, 02:10 AM
Hello,
I have been scouring forums for the last day or so.
Basically I have the following code.
Private Sub Cmd1_Click()
FirstMacro
AllWorkbookPivots
ThirdMacro
End Sub
Sub AllWorkbookPivots()
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
Sub FirstMacro()
ActiveWorkbook.RefreshAll
End Sub
Sub ThirdMacro()
MsgBox "Macro finished."
End Sub
However the message box and the pivot refresh occur before all of my ODBC data connections have been refreshed. Is there a way to ensure all have run prior to this?
I am a VB novice, this is some of my first code.
Many Thanks
Andrew
I have been scouring forums for the last day or so.
Basically I have the following code.
Private Sub Cmd1_Click()
FirstMacro
AllWorkbookPivots
ThirdMacro
End Sub
Sub AllWorkbookPivots()
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
Sub FirstMacro()
ActiveWorkbook.RefreshAll
End Sub
Sub ThirdMacro()
MsgBox "Macro finished."
End Sub
However the message box and the pivot refresh occur before all of my ODBC data connections have been refreshed. Is there a way to ensure all have run prior to this?
I am a VB novice, this is some of my first code.
Many Thanks
Andrew