PDA

View Full Version : Getting data from the web



westchris200
10-31-2011, 12:11 AM
Sub dhl()

Dim ie As SHDocVw.InternetExplorer
Set ie = New SHDocVw.InternetExplorer

Dim i As Integer

ie.Visible = True
ie.navigate "DHL-shipment rate"

Do
DoEvents
Loop Until ie.readyState = READYSTATE_COMPLETE

Dim doc As HTMLDocument
Set doc = ie.document
Dim sdd As String

With doc
.getElementById("ext-gen188").Value = 200000
.getElementById("ext-gen220").Value = "SINGAPORE"
.getElementById("ext-gen296").Value = "HONG KONG (HK)"
.getElementById("ext-gen352").Value = "Central"
.getElementById("details_weight_1").Value = 10
.getElementById("details_length_1").Value = 20
.getElementById("details_width_1").Value = 20
.getElementById("details_height_1").Value = 20
.getElementById("btn_quote_transit_time_and_prices").Click

End With

Do
DoEvents
Loop Until ie.readyState = READYSTATE_COMPLETE

sdd = doc.getElementById("ext-gen2281").Value
MsgBox sdd

End Sub


Please help
I am an absolute newbie to VBA programming, and searched on the internet found some goodie which could help automate my job.

Here are 2 problems I encountered.
1) I could input the Hong Kong into the form, but the problem is that I have to choose from the dropdown list. Simply putting .value Hong Kong is not possible.
2) Getting the data from the page, error 91.

Please helpppppp.

Thanks.

mancubus
11-01-2011, 04:47 PM
hi and wellcome to VBAX.

post#5 here may give you an idea...

http://www.mrexcel.com/forum/showthread.php?t=527874