zixyer
By: a guest | Dec 9th, 2008 | Syntax:
VisualBasic | Size: 0.85 KB | Hits: 98 | Expires: Never
Sub LoadZips()
Const ZIP_COLUMN As Integer = 1
Const OUTPUT_COLUMN As Integer = 2
Dim ie
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate "http://www.zipinfo.com/search/zipcode.htm"
Do Until ie.ReadyState = 4 ' READYSTATE_COMPLETE
DoEvents
Loop
For Each Cell In Selection
If Not ie.Document.Forms(0).tz.Checked Then
ie.Document.Forms(0).tz.Click
End If
ie.Document.Forms(0).zip.Value = Cells(Cell.Row, ZIP_COLUMN).Value
ie.Document.Forms(0).Go.Click
Do Until ie.Document.ReadyState = "complete"
DoEvents
Loop
Set tables = ie.Document.GetElementsByTagName("table")
Cells(Cell.Row, OUTPUT_COLUMN).Value = tables(3).Rows(1).Cells(3).innerText
Next Cell
End Sub