Getting data from the web

Steve_Ho

New Member
Joined
Oct 30, 2011
Messages
2
Sub dhl()

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

Dim i As Integer

ie.Visible = True
ie.navigate "http://dct.dhl.com/input.jsp?langId=en&originCCId=SG"

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.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,203,744
Messages
6,057,118
Members
444,906
Latest member
NanaExcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top