Consulting

Results 1 to 2 of 2

Thread: Getting data from the web

  1. #1

    Getting data from the web

    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.

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    hi and wellcome to VBAX.

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

    http://www.mrexcel.com/forum/showthread.php?t=527874
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •