Wait until query web page display ?

danial

Board Regular
Joined
Apr 29, 2006
Messages
107
Sawasdee,

I created script(macro) for import external data by "New Web Query..."
and I want to calculate data from qry data.
While excel getting data from web(do not display yet), script next step has been run.

How can I create script for wait it ?
I'm try with code
Code:
Application.wait
but it not work.

should you have any way for me.
thank a lot.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Daniel

you need to loop until the readystate = 4

I don't know how you have got to the web, but this may set you in the right direction.

Code:
Dim IExp As Object
  Set IExp = CreateObject("internetexplorer.application")
  IExp.navigate "http:yourURL"
'make sure the screen is fully activated
  Do Until IExp.readystate = 4
    DoEvents
  Loop


Tony
 
Upvote 0
I import data from web query by code below

Code:
        With ActiveSheet.QueryTables.Add(Connection:= _
            "URL;http://10.20.206.84/Hrcharter/Job.asp?key=" & PPID, Destination:=Range("A1"))
            .Name = "JobKey"
            .FieldNames = True
            .RowNumbers = False
            .FillAdjacentFormulas = False
            .PreserveFormatting = True
            .RefreshOnFileOpen = False
            .BackgroundQuery = False
            .RefreshStyle = xlInsertDeleteCells
            .SavePassword = False
            .SaveData = True
            .AdjustColumnWidth = True
            .RefreshPeriod = 0
            .WebSelectionType = xlEntirePage
            .WebFormatting = xlWebFormattingNone
            .WebPreFormattedTextToColumns = True '?
            .WebConsecutiveDelimitersAsOne = True
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = False
            .Refresh BackgroundQuery:=True
        End With
<recored by macro>

I'm nut sure that I will apply from "IExp.readystate = 4" (how to)
or set something properties
 
Upvote 0
Hi

Doing it that way, try changing the refresh line to

.Refresh BackgroundQuery:=False

I think that will force the code to wait until the data is extracted.


Tony
 
Upvote 0
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime



???
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,727
Members
449,049
Latest member
MiguekHeka

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top