Hi All,

I am trying to learn how to navigate web pages using internet explorer and VBA in Excel.

What I would like to do is to go to the following web page (allyouneedtotri.com/directory/listing/clubs-and-training-venues/159/triathlon-clubs), navigate to each 'more info' page and download all the email addresses from the 'more details' pages into a sheet (there is only one in each of the 'more details' tabs)

I would then like the macro to click the number 2 on the page allyouneedtotri.com/directory/listing/clubs-and-training-venues/159/triathlon-clubs, to display the next 10 items and then the macro needs to go to each of their 'more info' pages and download the email address from each page.

I have made a few attempts but I have made a complete mess of the code and nothing seems to work.

If someone could write the first part of the code so that I can have a look and learn from it then that would be awesome

Regards

Ross


My pitiful attempt at the initial part of the macro...


[VBA] Sub emails1()

Dim IE As InternetExplorer
Dim RegEx As Variant, RegMatch As Variant
Dim MyStr As String

Set IE = New IE
Set RegEx = New RegExp


IE.Navigate "http://www.allyouneedtotri.com/direc...iathlon-clubs/"
Do Until IE.ReadyState = READYSTATE_COMPLETE
Loop

'String to parse google search for a VBAX reference
With RegEx
.Pattern = "wp-content/themes/ayntt/images/more-detail-button.png"
.MultiLine = True
End With

'return text from google page
MyStr = IE.Document.body.innertext
Set RegMatch = RegEx.Execute(MyStr)

'If a match to our RegExp searchstring is found then launch this page
If RegMatch.Count > 0 Then
IE.Navigate RegMatch(0)
Do Until IE.ReadyState = READYSTATE_COMPLETE
Loop
MsgBox "Loaded VBAX link"
'show internet explorer
IE.Visible = True
Else
MsgBox "No VBAX link found"
End If

Set RegEx = Nothing
Set IE = Nothing
End Sub
[/VBA]