pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
Is there a way for VBA to wait till connection is completely refreshed and not go and execute everything?
'm getting error '1004 - Please wait until Microsoft Excel has finished refreshing the PivotTable report, and then try the command again.'
Plese help.
thanks in advance.
'm getting error '1004 - Please wait until Microsoft Excel has finished refreshing the PivotTable report, and then try the command again.'
Code:
[FONT=Courier New]Sub RefreshConection()
ThisWorkbook.Connections("MainDbData").Refresh
'run this lines below only after refreshing data from database
[FONT=Courier New] ActiveSheet.PivotTables("Top5Pivot").PivotFields("Week").ClearAllFilters
ActiveSheet.PivotTables("Top5Pivot").PivotFields("Week").CurrentPage = "20"[/FONT]
End Sub[/FONT]
Plese help.
thanks in advance.