[Vba Excel] Query Refresh
Solved
kilian
Posted messages
8675
Registration date
Status
Moderator
Last intervention
-
kilian Posted messages 8675 Registration date Status Moderator Last intervention -
kilian Posted messages 8675 Registration date Status Moderator Last intervention -
Hello,
I have a little issue with a VBA macro.
Actually, it looks like this:
The big problem is that the query refresh only happens at the end of the script.
I'm doing it like this:
I've tried other things like declaring this refresh in a function and calling it in the macro procedure... Or even using a macro that calls in order the refresh macro and then another macro where the rest of the instructions are, but it doesn't change anything, I still have the same effect.
Do you have any idea?
Thanks.....
I have a little issue with a VBA macro.
Actually, it looks like this:
sub macro() Variable declaration Selecting the first cell Refreshing the query Instructions.... end sub
The big problem is that the query refresh only happens at the end of the script.
I'm doing it like this:
Selection.QueryTable.Refresh
I've tried other things like declaring this refresh in a function and calling it in the macro procedure... Or even using a macro that calls in order the refresh macro and then another macro where the rest of the instructions are, but it doesn't change anything, I still have the same effect.
Do you have any idea?
Thanks.....
Configuration: Windows 2000 Excel 2000
6 answers
Got it :-)
The query update should not happen in the background:
The query update should not happen in the background:
Selection.QueryTable.Refresh BackgroundQuery:=False
You mean that you trigger the query refresh but no matter when the code continues to run and doesn't wait for the end of this refresh?
--
COIN!
--
COIN!
Absolutely :-)
Wherever I place the update, it only executes at the end of the macro.....
As a result, all the subsequent instructions perform operations in vain....
Wherever I place the update, it only executes at the end of the macro.....
As a result, all the subsequent instructions perform operations in vain....
I just tried with this:
http://www.ilook.fsnet.co.uk/vb/vbsleep.htm
The waiting happens but the request only executes at the end, just like before.....
http://www.ilook.fsnet.co.uk/vb/vbsleep.htm
The waiting happens but the request only executes at the end, just like before.....