ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Web Browswer Control (https://www.excelbanter.com/excel-programming/309360-web-browswer-control.html)

JT[_2_]

Web Browswer Control
 
What I'm trying to do is navigate through a series of web
pages (displayed on the WebBrowser Control on an Excel
sheet). Sometimes data is entered and sometimes a button
is just selected.

What I'm looking for is code that will allow the macro to
move on once the page has been completely loaded. (I'm
trying the DocumentComplete event but I don't have the
syntax right yet.)

Here is a sample of what I am trying to do:

Dim IElem As HTMLInputElement
Set WebDoc = Worksheets(1).WebBrowser1.Document

For Each IElem In WebDoc.forms(0).elements

Select Case IElem.Name
Case "PrincipalName"
IElem.Value = ShopNum
End Select

Next IElem

intReadyState = 0

Worksheets(1).WebBrowser1.Navigate "javascript:validate
(document.keyForm);"

(Note: below is my attempt to cycle through a loop until
the ReadyState = 4) at which point the macro would move on
to the next statement. Once ReadyState = 4, we assumed
that it meant the page had finished loading. However, it
just keeps cycling through the loop until I use CTRL +
Break.)

Do While Not intReadyState = 4
intReadyState = WebDoc.ReadyState
Loop

intReadyState = 0

(Note: this is the point where I am looking for code that
will allow the macro to continue once the page has loaded.)

Thanks for suggestions....JT



All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com