Hello Manifest0,
Here is a workbook that extracts the emails from the sites you provided. Expand the list as needed. This method is the fastest available. Here are the macros used in the attached workbook.
' Thread: http://www.excelforum.com/excel-programming/793412-vba-script-to-retrieve-text-from-label-on-webpage.html#post2605487
' Poster: Manifest0
' Written: Septemeber 21, 2011
' Author: Leith Ross
Sub ExtractEmailAddresses()
Dim Cell As Range
Dim RegExp As Object
Dim Rng As Range
Dim RngEnd As Range
Dim Text As String
Dim Wks As Worksheet
Set Wks = ActiveSheet
Set Rng = Wks.Range("A2")
Set RngEnd = Wks.Cells(Rows.Count, Rng.Column).End(xlUp)
If RngEnd.Row < Rng.Row Then Exit Sub Else Set Rng = Wks.Range(Rng, RngEnd)
For Each Cell In Rng
Text = GetPageSource(Cell)
X = InStr(1, Text, "Email:")
If X Then
Y = InStr(X + 6, Text, "href=""")
X = InStr(Y + 6, Text, ">")
Y = InStr(X + 1, Text, "<")
Cell.Offset(0, 1) = Mid(Text, X + 1, Y - X - 1)
End If
Next Cell
End Sub
Function GetPageSource(ByVal URL As String) As String
Dim Request As Object
On Error Resume Next
Set Request = CreateObject("WinHttp.WinHttpRequest.5.1")
If Request Is Nothing Then Set Request = CreateObject("WinHttp.WinHttpRequest.5")
Err.Clear
On Error GoTo 0
Request.Open "GET", URL, False
Request.Send
GetPageSource = Request.responsetext
End Function
Bookmarks