I'm currently using a macro to enter information on an internet page and click through a number of forms. I'm running into a problem that my do until ready state loop isn't waiting for the page to completely load before the macro continues on. Here is my wait code:
Is there a way to write a loop that searches the page for an actual text to show up and then end the loop.
So from a sample of the HTML code, I would be waiting for the words "Data Preview:" to appear as it is unique to the page that is loading.
Being able to wait for a word to appear would help in some other situations I have too.
Code:
Dim objCollection As Object
Dim objElement As Object
Set objCollection = .document.getElementsByTagName("input")
i = 0
While i < objCollection.Length
If objCollection(i).Type = "submit" And _
objCollection(i).Name = "ctl00$MainContent$ImportWizard$wzImportRecords$StartNavigationTemplateContainerID$StartNextButton" Then
Set objElement = objCollection(i)
End If
i = i + 1
Wend
objElement.Click
Do Until .readyState = 4
DoEvents
Loop
Is there a way to write a loop that searches the page for an actual text to show up and then end the loop.
So from a sample of the HTML code, I would be waiting for the words "Data Preview:" to appear as it is unique to the page that is loading.
HTML:
<td align="left" style="color:White;background-color:#5D7B9D;border-style:Solid;font-weight:bold;">Batch: 4113 File: </td>
</tr><tr style="height:100%;">
<td valign="top" style="color:#5D7B9D;border-width:0px;">
<table width="100%">
<tr>
<td align="Left">
Data Preview:
</td>
</tr>
<tr>
<td>
<div style="width: 800px; overflow: scroll;">
<div>
<table cellspacing="0" rules="all" border="1" id="ctl00_MainContent_ImportWizard_wzImportRecords_gvPreviewData" style="border-collapse:collapse;">
Being able to wait for a word to appear would help in some other situations I have too.