one way
create a userform and add a combo box and command button , Reference Library "Microsoft HTML Object Library"
copy and paste the code below into the userform
Option Explicit
Private Sub CommandButton1_Click()
Dim appIE As Object
Dim sURL As String
Application.ScreenUpdating = False
Set appIE = GetIE
sURL = "http://data.worldbank.org/country/" & Me.ComboBox1.Value
With appIE
.navigate sURL
.Visible = True
End With
Application.ScreenUpdating = True
Set appIE = Nothing
End Sub
Private Sub UserForm_Initialize()
Dim htm As HTMLDocument, objTable As Object, objTd As Object, objDat As Object
Dim Myarray() As String, intRow As Long, intCol As Long
Set htm = New HTMLDocument
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", "http://data.worldbank.org/country", False
.send
htm.body.innerHTML = .responseText
End With
With htm
Set objTable = .getElementById("block-views-countries-block_1").getElementsByTagName("tr")
ReDim Myarray(1 To (objTable.Length + 1), 1 To 1)
For intRow = 0 To objTable.Length - 1
Set objTd = objTable(intRow).getElementsByTagName("td")
For Each objDat In objTd
Debug.Print objDat.innerText
intCol = intCol + 1
Myarray(intRow + 1, 1) = objDat.innerText
Next
Next
End With
Me.ComboBox1.List = Myarray
End Sub
Function GetIE() As Object
On Error Resume Next
Set GetIE = CreateObject("InternetExplorer.Application")
End Function
Bookmarks