Charley
Member
- Joined
- Jul 29, 2017
- Messages
- 64
- Reaction score
- 0
- Points
- 6
- Excel Version(s)
- 365
I have a PQ query, linked to a parameter Table, which updates an Excel Table in my workbook. And I have VBA code that looks sorta like this...
For each URL in a Table column
Write the new URL to a parameter Table
Refresh the PQ connection
Do stuff with the data in the refreshed Table
Next URL
My problem is that the connection doesn't reliably refresh. I've tried to refresh it using MyConnection.Refresh. I've tried using ActiveWorkbook.RefreshAll. I've tried DoEvents. I've tried waits for as long as ten seconds, even though the query takes only about a second when I refresh it manually. I've tried looping thru multiple refreshes. All with no joy.
Sometimes it refreshes but most of the time it doesn't. But it always works manually.
Some of you guys have been doing this for several years. I've only concentrated on PQ today, as my other posts today indicate. Someone MUST have an answer. How the HECK do you refresh web queries RELIABLY with VBA?
Thanks.
Charley
For each URL in a Table column
Write the new URL to a parameter Table
Refresh the PQ connection
Do stuff with the data in the refreshed Table
Next URL
My problem is that the connection doesn't reliably refresh. I've tried to refresh it using MyConnection.Refresh. I've tried using ActiveWorkbook.RefreshAll. I've tried DoEvents. I've tried waits for as long as ten seconds, even though the query takes only about a second when I refresh it manually. I've tried looping thru multiple refreshes. All with no joy.
Sometimes it refreshes but most of the time it doesn't. But it always works manually.
Some of you guys have been doing this for several years. I've only concentrated on PQ today, as my other posts today indicate. Someone MUST have an answer. How the HECK do you refresh web queries RELIABLY with VBA?
Thanks.
Charley