+ Reply to Thread
Results 1 to 2 of 2

Extract information from a site

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-03-2009
    Location
    USA, California
    MS-Off Ver
    Excel 2007
    Posts
    385

    Extract information from a site

    I want to extract all information from the below site:

    https://www.pucatrade.com/sendCards.html

    It is required that the user logs in (must have a user name as password). It is free to register at though. I am hoping someone can help me. I want to extract information from the site.

    puca.PNG

    The above is the portion of the site that I want extracted. Sometimes it will be blank. Basically I want to be able to parse data from the site (preferably without ever showing IE). I want to know when that portion of the site isn't blank. Maybe a way to login to the site in the code too, not to big of a deal if it isn't possible. And if someone can maybe just help extract all data from the site without having to create an account for the website that would work too, as I have enough knowledge of excel that I could write a formatting macro to extract the relevant data.

  2. #2
    Forum Contributor
    Join Date
    04-03-2009
    Location
    USA, California
    MS-Off Ver
    Excel 2007
    Posts
    385

    Re: Extract information from a site

    This is what I found but I don't know how to "login" using this code. Also there is a script error that appears when it runs, is there a way to suppress this error?
    Public Sub WebQuery()
    Dim cnt As Long
    Dim waitTime As Long
    
    alertTime = Now + TimeValue("00:02:00")
    Application.OnTime alertTime, "WebQuery"
    
    Const READYSTATE_COMPLETE As Long = 4
    Dim x As Integer
    
    URL = "https://www.pucatrade.com/sendCards.html"
    Set ie = Sheet2.WebBrowser1
    ie.Visible = 1
    DoEvents
    ie.navigate URL
    Do Until ie.readyState = READYSTATE_COMPLETE
    DoEvents
    Loop
    
    Application.DisplayAlerts = False
    
    Do Until ie.readyState = READYSTATE_COMPLETE
    DoEvents
    Loop
    Application.Wait Now + TimeValue("00:00:03")
    HTMLdata = Sheet2.WebBrowser1.document.DocumentElement.innerText
    HTMLdata = VBA.Split(HTMLdata, Chr(13)) 'change the split as required CHR(13) is for carriage return.
    For x = 0 To UBound(HTMLdata)
    Sheet1.Range("A" & (x + 1)) = HTMLdata(x)
    Next x
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Use VBA to extract certain data from the WhoIs Web Site
    By JohnM3 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-31-2013, 12:48 AM
  2. [SOLVED] Vba to extract data from a web site
    By franunzio in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-28-2012, 08:00 PM
  3. Bringing information from a web site to an Excel file
    By Hikmetotheron in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-26-2012, 08:24 AM
  4. Need to have macro that goes to a specific site for update information
    By Autin in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-19-2012, 12:26 PM
  5. auto extract data from web site
    By plato in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-31-2011, 06:02 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1