Consulting

Results 1 to 20 of 20

Thread: How to Fetch Web Data into Excle

  1. #1

    Question How to Fetch Web Data into Excle

    Hi There

    Can Anyone tell me how to Fetch record from Website database into Excel Through Excel macro code.

  2. #2
    You will need a page on the site that returns a html table with the record information.
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  3. #3
    There is a database page to Access the data. but there is a limitation of no. i can only track few NO.

  4. #4
    What do you mean a limitation of no?
    Does the page only show a part of the records that are in the database?
    In that case, you'll have to talk to the guy who manages the website and ask him to have the page return more.
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  5. #5
    Well Yes..

    Actually the database is In SQL which is Accessed by the we people at different Locations.Noe the problem is that We have to search it from the web..it takes time to get the details From The Web.Yes i have talked with the developer of the site They are not authorized to do that.

  6. #6
    Still Wating For Your Reply..

  7. #7
    I'm still not sure what your problem is exactly.
    Could you perhaps provide an example url where I can see the data and try to explain what it is that's missing?
    Can you use a web query from within Excel to pull in the dat directly? (Data, Get eternal data, new web query)
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  8. #8
    http://59.163.53.210/n_ctrack_dom.asp is the url from where i have to fetch the data into the excel sheet.

    There is C/no say b123456..
    the details of that should come automatically into the excel file

  9. #9
    OK, got it now. Unfortunately, this requires VBA programming and takes much more time than I have available at the moment.
    I can write the code for you commercially, but I doubt if that is what you want, correct?
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  10. #10
    I Know that That is Why i Joined this form.
    I have Developed a code earlier But it is not working with this link.
    Here find that code.
    [vba]Sub Test()
    Dim Sh As Worksheet
    Dim Rng As Range
    Dim ShNew As Worksheet
    Dim r As Integer
    Dim Cell As Range
    Dim URL As String
    Set Sh = Worksheets("Sheet1")
    With Sh
    Set Rng = .Range("A2:A" & .Range("A" & .Rows.Count).End(xlUp).Row)
    End With
    Set ShNew = Worksheets.Add
    r = 1
    For Each Cell In Rng
    URL = "URL;http://www.firstflight.net/n_contrac_new.asp?tracking1=" & Cell.Value
    With ShNew.QueryTables.Add(Connection:=URL, Destination:=ShNew.Cells(r, 1))
    .WebSelectionType = xlSpecifiedTables
    .WebFormatting = xlWebFormattingAll
    .WebTables = "21"
    .Refresh BackgroundQuery:=False
    End With
    With ActiveSheet
    .QueryTables(1).Delete
    .Cells(r, 1).Resize(3).EntireRow.Delete
    End With
    r = r + 1
    Next Cell
    End Sub[/vba]
    Now the Problem is that it is not working with http://59.163.53.210/n_ctrack_dom.asp this link

    That is why i Required & want You Help..
    Last edited by Aussiebear; 08-09-2011 at 03:26 PM. Reason: Applied VBA tags to code

  11. #11
    Could you give me a valid tracking number?
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  12. #12
    Here Find the Few..

    ZB6424134
    ZB6430739
    ZD6419468
    ZB6423408

  13. #13
    I tried to adopt this code to extract the results to a file, but it fails.

    Problem is I don't know how to pas the track number to the website:

    [vba]Sub DoIt()
    Dim sURL As String
    Dim sData As String
    Dim xmlhtp As MSXML2.XMLHTTP40
    Dim xmlDoc As DOMDocument

    sURL = "http://59.163.53.210/n_ctrack_dom.asp"
    Set xmlhtp = New MSXML2.XMLHTTP40
    sData = "ZB6424134"
    With xmlhtp
    .Open "post", sURL, False
    .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    .send sData
    Set xmlDoc = New DOMDocument
    xmlDoc.loadXML .responseText
    MsgBox .responseText
    Open ThisWorkbook.Path & "\WebQueryResult.html" For Output As #1
    Write #1, .responseText
    Close #1
    End With
    End Sub
    [/vba](needs a reference to the Microsoft XML library)
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  14. #14
    Im sorry Ididnt Get U..

  15. #15
    SIr im still waiting to get a solution.

    I have downloaded & installed Microsoft XML library But still it is not working Properly.

  16. #16


    Still waiting for nay Reply.

  17. #17
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    that site requires login to related page.
    this may help with this.
    http://www.vbaexpress.com/kb/getarticle.php?kb_id=399

    then you must google stg like "excel vba pull data from web"
    here is a sample:
    http://www.vbaexpress.com/kb/getarticle.php?kb_id=576
    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)

  18. #18
    Sorry, I was too busy!
    mancubus seems to have given you some useful pointers though.
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  19. #19
    mancubus Thanks Fro Your Reply ..but it not working..


    Can you please help me with the Link which i have provided.

  20. #20
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    perhaps recording a web query macro with real data and modifiying the code in post#10 will help.

    if i were assigned such a project, keeping in mind that i'm not experienced, i would contact the web designers from it department -or my customer representative, if any, who may built connection with them- of the forwarder company. to get the table, form, element id's etc.

    since these are one word parameters, companies may help on this as part of customer satisfaction policies.

    for experts, it may be easy to extract related info from html document.
    below may give an idea...
    http://www.tushar-mehta.com/publish_...ages_services/
    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
  •