Forum Discussion
AydeeDiaz
Oct 20, 2022Copper Contributor
Wait until query is refreshed to run the next macro
Hi! I am trying to create a macro, but I need to wait until query is refreshed before doing the copy to paste in the workbook Sub OpenAnyFile() VBA.Shell "Explorer.exe C:\Users\vjrdcx\Aptiv\Apti...
JKPieterse
Oct 21, 2022Silver Contributor
You can set the queries in question to be synchronous.
AydeeDiaz
Oct 24, 2022Copper Contributor
Sorry what do you mean??
- JKPieterseOct 24, 2022Silver ContributorThere is a checkbox in the query properties that either allows or disallows the query to run in the background. Make sure it disallows it.
- AydeeDiazOct 24, 2022Copper ContributorBut the thinks is that I don't have a code to wait until query is refreshed in OTHER workbook and then come back to the code workbook and continue the macro, how can I do it?
- JKPieterseOct 25, 2022Silver Contributor
As long as the queries are set up to be synchronous, the VBA code does not matter as it will wait for the refresh to finish before proceeding.