We help IT Professionals succeed at work.

Opening multiple webpages

John Account
John Account asked
on
Medium Priority
145 Views
Last Modified: 2010-05-01
Hello Experts. I have a browser control through which I want to open many web pages, one at a time, wherein I will search for information that may have changed. I don't need help with how to search for the info I'm looking for. What I need your help with is how to go through one page at a time, waiting till the seach therein is done before moving on to the next URL. I've gotten very rusty working with Arrays, so I'll need some extra attention here. This page seems to be onto something, but I need more elaboration:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20177242.html?query=browser+control+loop+through+links&topics=93#6449318

Many kind thanks in advance,
John
Comment
Watch Question

A very basic example, using the WebBrowser control, is to try the following (using a form -- Form1, with a button -- Command1 -- and a WebBrowser -- WebBrowser1):

    Sub Command1_Click()
        Dim szURL as Variant, a_szURLs As Variant
        Set a_szURLS = Array("http://www.mydomain.com/page1.htm", _
                                         "http://www.mydomain.com/page2.htm", _
                                         "http://www.mydomain.com/page3.htm", _
                                         "http://www.mydomain.com/page4.htm")

        For Each szURL In a_szURLs                                                                           'LOOP THROUGH THE URLS
            WebBrowser1.Navigate2 szURL                                                                   'LOAD THE URL
            Do Until (WebBrowser1.ReadyState = 4) And (WebBrowser1.Busy = False)    'ALLOW PAGE TO LOAD
                DoEvents
            Loop
            DoYourCheck()
        Next szURL
    End Sub

    Sub DoYourCheck()
        'YOUR CHECK CODE GOES HERE
    End Sub

HTH

J.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Getting a Type Mismatch on that array.
Take out the Set command:

    a_szURLs = Array(...)

J.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.