I am trying to loop through a list of names in an Excel spreadsheet using VBA and I would like to paste a surname into a text box on a webpage and then extract the returned phone number into a cell after the page has been submitted.
I can only do this one name at a time so I would like to automate this process as there are several hundreds of them. I can do the Excel looping but I don’t know how to interact with the webpage.
Can anybody help, or point me in the right direction please?
Regards, Ian.
this should help.
As an example, I’ve used one of the millions of random name generators that exist on the ‘Net. This code opens an IE instance, navigates to “http://www.behindthename.com/random/“, inputs the surname to the form, submits the form, and returns the resulting HTML body.
I haven’t parsed the result page HTML to return the actual name, as this will be different for your site, but this should help you get started.
You’ll need a reference to “Microsoft Internet Controls” to access the SHDocVw.InternetExplorer object.
Hope this helps.