Results 1 to 3 of 3

Web scraping for stock data macro

Threaded View

  1. #1
    Registered User
    Join Date
    12-31-2017
    Location
    Moscow
    MS-Off Ver
    2013
    Posts
    8

    Web scraping for stock data macro

    Hello

    I am trying to make a web scraping macro in order to get stock information from a website based on the stock's registration number (ISIN number)

    Here is what I have so far:

    Sub Get_Stock_Data()
    
        Dim Page As New XMLHTTP60
        Dim Doc As New HTMLDocument
        Dim inputbox As IHTMLElement
        
        Dim Table As IHTMLElement
        Dim cel As IHTMLElement
        
        Page.Open "get", "URL", False
        Page.send
        
        Doc.body.innerHTML = Page.responseText
        
        Set inputbox = Doc.getElementById("searchTextTop")
        inputbox.Value = "US0378331005"
        
        Set Table = Doc.getElementsByTagName("table")(1)
        
        For Each cel In Table.getElementsByTagName("td")
            Debug.Print cel.tagName, cel.className, cel.getAttribute("link")
        Next
        
    End Sub
    The ISIN number is being input into the search box on top of the page. After inserting the ISIN number an autocomplete table is generated, which contains the necessary query string that is needed in order to navigate to the stock's main page.
    What I need is to get the "innerText" from the "link" attribute of the second <td> tag, however upon running the macro it returns that value as "null". The HTML code generated from the website is in the attached word file.
    Would be great if someone could help out.

    Thx in advance!
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 31
    Last Post: 10-28-2015, 01:54 AM
  2. VBA/macro for scraping prices from multiple websites
    By tylersfd2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-03-2015, 07:51 PM
  3. Replies: 0
    Last Post: 04-10-2015, 04:34 PM
  4. VBA Code to pull Stock Balance Sheet Data from a Stock Symbol in a cell
    By akash1229 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 02-27-2015, 04:37 PM
  5. Replies: 0
    Last Post: 10-28-2012, 07:22 AM
  6. Gathering Stock Data from Yahoo MACRO help
    By denisl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-11-2012, 04:39 PM
  7. Macro to download monthly stock data and to refresh that data with the macro
    By Frankdude in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-23-2011, 08:38 PM

Tags for this Thread

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