dcsimg
Results 1 to 3 of 3

Thread: Extract Data From A Webpage

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    18

    Extract Data From A Webpage

    Hi All,

    I have the following code to open a webpage:

    Code:
        Dim IE As Object
        Dim x As Integer
        Dim c As Variant
    
        x = 1
        Do Until x = c + 1
    
        Set IE = CreateObject("InternetExplorer.Application")
        With IE
            .Visible = True
            .Navigate "http://api.eventful.com/rest/events/search?...&c=food&t=future&location=Chicago&page_number=" & x & "&page_size=100&app_key=xxxx" ' should work for any URL"
            Do Until .ReadyState = 4: DoEvents: Loop
        End With
     
        IE.ExecWB 17, 0 '// SelectAll
        IE.ExecWB 12, 2 '// Copy selection
        ActiveSheet.PasteSpecial Format:="Text", link:=False, DisplayAsIcon:=False
        Range("A1").Select
        Selection.End(xlDown).Offset(1).Select
        x = x + 1
        IE.Quit
        Loop
    End Sub
    The page that opens is in xml and in that xml there is the "page_count" that I need to pick out so I can tell my macro when to stop looping. I have dimmed it as "c" in the code above. Following is the XML.

    <search>
    <total_items>360</total_items>
    <page_size>100</page_size>
    <page_count>4</page_count>

    Somehow I need c = "4", which is the "page_count". Does anyone know how I can pick out the "4" from the xml on my page?

  2. #2
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,183

    Wink Re: Extract Data From A Webpage

    have a look at this post answered by pradeep here

    and just check out Kleinma's signatures
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    18

    Re: Extract Data From A Webpage

    Not exactly what I was looking for but I can use this for something else... Thank you!

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width