S
sal21
this is my old macro to get data from web:
Option Explicit
Sub PostalCodes()
Dim ie As Object
Dim lngRow As Long
Dim lngMaxRow As Long
Set ie = CreateObject("InternetExplorer.Application")
On Error GoTo errHandler
lngMaxRow = Range("A65536").End(xlUp).Row
With ie
For lngRow = 2 To lngMaxRow
..navigate
"http://www.canadapost.ca/personal/tools/pcl/bin/quick-e.asp"
Do While .busy
DoEvents
Loop
Do While .ReadyState <> 4
DoEvents
Loop
With .document.Forms(1)
'Street Number
..street_number.Value = Range("A" & lngRow)
'Street Name
..street_name.Value = Range("B" & lngRow)
'City
..city.Value = Range("C" & lngRow)
'AB = Alberta, BC = British Columbia, MB = Manitoba, NB = New
Brunswick, _
NL = Newfoundland And Labrador, NS = Nova Scotia, NT =
Northwest Territories, _
NU = Nunavut, ON = Ontario, PE = Prince Edward Island, QC =
Quebec, _
SK = Saskatchewan, YT = Yukon
..prov.Value = Range("D" & lngRow)
..submit
End With
Do While Not CBool(InStrB(1, .document.URL,
"cp_search_response-e.asp"))
DoEvents
Loop
Do While .busy
DoEvents
Loop
Do While .ReadyState <> 4
DoEvents
Loop
On Error Resume Next
'CONSIDERARE PRIMA CELLA COME POSISZIONE "ZERO"
Range("E" & lngRow) =
UCase(.document.all.tags("table").Item(11).Rows(1).Cells(7).innerText)
Range("F" & lngRow) =
UCase(.document.all.tags("table").Item(11).Rows(1).Cells(1).innerText)
On Error GoTo errHandler
Next lngRow
End With
errHandler:
ie.Quit
Set ie = Nothing
Exit Sub
End Sub
i would want to arrange this code for this link:
http://www.bancaroma.it/abicab/index.asp
in effect put the value from column A and column B into ABI and CAB
txtbox into home page, and get, after the result the value from the
search page. Put the value into sheet attached.
Tks for all.
+-------------------------------------------------------------------+
|Filename: TROVA_CAP_DA_BANCA_DI_ROMA.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3601 |
+-------------------------------------------------------------------+
Option Explicit
Sub PostalCodes()
Dim ie As Object
Dim lngRow As Long
Dim lngMaxRow As Long
Set ie = CreateObject("InternetExplorer.Application")
On Error GoTo errHandler
lngMaxRow = Range("A65536").End(xlUp).Row
With ie
For lngRow = 2 To lngMaxRow
..navigate
"http://www.canadapost.ca/personal/tools/pcl/bin/quick-e.asp"
Do While .busy
DoEvents
Loop
Do While .ReadyState <> 4
DoEvents
Loop
With .document.Forms(1)
'Street Number
..street_number.Value = Range("A" & lngRow)
'Street Name
..street_name.Value = Range("B" & lngRow)
'City
..city.Value = Range("C" & lngRow)
'AB = Alberta, BC = British Columbia, MB = Manitoba, NB = New
Brunswick, _
NL = Newfoundland And Labrador, NS = Nova Scotia, NT =
Northwest Territories, _
NU = Nunavut, ON = Ontario, PE = Prince Edward Island, QC =
Quebec, _
SK = Saskatchewan, YT = Yukon
..prov.Value = Range("D" & lngRow)
..submit
End With
Do While Not CBool(InStrB(1, .document.URL,
"cp_search_response-e.asp"))
DoEvents
Loop
Do While .busy
DoEvents
Loop
Do While .ReadyState <> 4
DoEvents
Loop
On Error Resume Next
'CONSIDERARE PRIMA CELLA COME POSISZIONE "ZERO"
Range("E" & lngRow) =
UCase(.document.all.tags("table").Item(11).Rows(1).Cells(7).innerText)
Range("F" & lngRow) =
UCase(.document.all.tags("table").Item(11).Rows(1).Cells(1).innerText)
On Error GoTo errHandler
Next lngRow
End With
errHandler:
ie.Quit
Set ie = Nothing
Exit Sub
End Sub
i would want to arrange this code for this link:
http://www.bancaroma.it/abicab/index.asp
in effect put the value from column A and column B into ABI and CAB
txtbox into home page, and get, after the result the value from the
search page. Put the value into sheet attached.
Tks for all.
+-------------------------------------------------------------------+
|Filename: TROVA_CAP_DA_BANCA_DI_ROMA.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3601 |
+-------------------------------------------------------------------+