Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    modify and explain (2000 sr 1)

    This code put a data into a web page and get data from a page searched...
    Is possible:
    Inested a fixed value into code
    ==========================
    'Stree Number
    .street_number.Value = "10132"
    'Stree Name
    .street_name.Value = "Imperial Street"
    'City
    .city.Value = "Chilliwack"
    '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 = "BC"
    ==========================

    Is possible to insert a value present into a column of sheet for example in

    A column Stree Number
    B column Stree Name
    ecc...

    And cycling the variuos column if the value are most of one for example 30 make a for next do until the and of value into variuo column....

    The example when get te result put the value into a msgbox, is possible to insert the value into a sheet onto the same wbook?

    To explain:
    but into code wath is the command to get the value when the page is shown?



    SubPostalCodes()
    Dim ie As Object
    Set ie = CreateObject("InternetExplorer.Application")
    On Error GoTo errHandler
    With ie
    .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)
    'Stree Number
    .street_number.Value = "10132"
    'Stree Name
    .street_name.Value = "Imperial Street"
    'City
    .city.Value = "Chilliwack"
    '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 = "BC"
    .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
    MsgBox .document.all.tags("table").Item(11).Rows(1).Cells (7).innerText
    End With
    Exit Sub

    errHandler:
    ie.Quit: Set ie = Nothing
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: modify and explain (2000 sr 1)

    Try the code in the attachment.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: modify and explain (2000 sr 1)

    good, NATURALLY!
    But to understand the code...
    In wath position of serced oage the code get the value:V2P 7N8?
    And wath is the commnand line to define the fixed position to get the value:V2P 7N8?
    TIA (is correct?- Tks In Advance)

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: modify and explain (2000 sr 1)

    The line

    Range("E" & lngRow) = .document.all.tags("table").Item(11).Rows(1).Cells (7).innerText

    fills in the postal code in column E. It says: take the text from the 7th cell in the 1st row in the 11th table in the web page (the one that shows the result). I assume that the person who wrote the original code analyzed the web page to find which table contains the postal code.

Posting Permissions

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