Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with webquery in VBA

Hello,

I've a little problem with creating webqueries and handling the
resulting data with a VBA macro. The problem is that the statements
after the webquery are not effectively handled.

To investigate the issue I created 2 macro's. The first macro
refreshes the webquery. The second macro handles the data retrieved by
the webquery. If I start macro1 it refreshes the query data as
intended. When macro1 is finished I manually start macro2 which
handles the retrieved data exactly as intended. Then I created a third
macro. The only thing this third macro does is start macro1 and then
start macro2. The result is that effectively only macro1 runs. If I
watch the screen closely however it looks like first macro1 obtains
the data from the web, then macro2 runs on the old data and then, on
ending macro3, the data obtained with macro1 is saved in the
worksheet.

In short, I've the impression that Excel refreshes the webquery
correctly, but only saves the obtained data when all macro's are
finished.

Is there any-one who knows a solution for this issue?

grtnx
Wilco
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Problem with webquery in VBA

It might be that the querytable is configured to refresh in the background -
control is passed back to the next line of code before the query finishes
refreshing.

When running the Refresh method, try something like:
qtb.Refresh BackgroundQuery:=False

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Wilco" wrote in message
om...
Hello,

I've a little problem with creating webqueries and handling the
resulting data with a VBA macro. The problem is that the statements
after the webquery are not effectively handled.

To investigate the issue I created 2 macro's. The first macro
refreshes the webquery. The second macro handles the data retrieved by
the webquery. If I start macro1 it refreshes the query data as
intended. When macro1 is finished I manually start macro2 which
handles the retrieved data exactly as intended. Then I created a third
macro. The only thing this third macro does is start macro1 and then
start macro2. The result is that effectively only macro1 runs. If I
watch the screen closely however it looks like first macro1 obtains
the data from the web, then macro2 runs on the old data and then, on
ending macro3, the data obtained with macro1 is saved in the
worksheet.

In short, I've the impression that Excel refreshes the webquery
correctly, but only saves the obtained data when all macro's are
finished.

Is there any-one who knows a solution for this issue?

grtnx
Wilco



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Webquery from other browser Serpy-kun Excel Discussion (Misc queries) 1 September 4th 08 10:19 PM
Webquery Neale Excel Worksheet Functions 3 August 25th 08 05:26 PM
Webquery Othello Excel Discussion (Misc queries) 0 December 1st 04 12:41 PM
How to disconnect when WebQuery done Nathan Gutman Excel Programming 4 December 24th 03 03:31 PM
Using Webquery via VBA Richard Winston Excel Programming 3 December 2nd 03 12:50 PM


All times are GMT +1. The time now is 05:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"