Web Browswer Control

J

JT

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top