Results 1 to 3 of 3

EXCEL VBA scraping webpage

Threaded View

timmy2020 EXCEL VBA scraping webpage 12-08-2019, 05:34 PM
Pepe Le Mokko Re: EXCEL VBA scraping webpage 12-09-2019, 03:37 AM
k1dr0ck Re: EXCEL VBA scraping webpage 12-09-2019, 05:16 AM
  1. #1
    Registered User
    Join Date
    12-08-2019
    Location
    brazil
    MS-Off Ver
    365
    Posts
    1

    EXCEL VBA scraping webpage

    having a few issues getting an excel vba to scrape a webpage.

    I require a vba to do the following

    1. visit the url on the excel sheet - There is a whole list of 100 URL's.
    2. extract 3 data sets
    3. populate 3 columns in the excel sheet
    4. Loop to next url in list.

    I have managed to extract the data i need and get it into the immediate view window in but I am struggling to set the value of the URL from the cell and loop down the list.

    I wish i could share the website but there is a login and password access required.

    i have put +++++ where the url should be.

    any pointers or help i will be grateful for


    Sub Browsetosite()
    
        Dim IE As New SHDocVw.InternetExplorer
        Dim HTMLDoc As MSHTML.HTMLDocument
        Dim HTMLInput As MSHTML.IHTMLElement
        Dim HTMLTrs As MSHTML.IHTMLElementCollection
        Dim HTMLTr As MSHTML.IHTMLElement
        Dim rows As Long
        
    
        IE.Visible = True
        
        IE.Navigate "+++++", False
        
        
        Do While IE.ReadyState <> READYSTATE_COMPLETE
        Loop
        
        Set HTMLDoc = IE.Document
        
      
        Set HTMLTrs = HTMLDoc.getElementsByTagName("td")
            
        For Each HTMLTr In HTMLTrs
    
    
       ' Debug.Print HTMLTr.getAttribute("id"), ",", HTMLTr.innerText, HTMLTr.innerHTML
                         
        'code below find eb number title and code and assigns it to row E1, F1 and G1
        If HTMLTr.getAttribute("id") = "ctl00_bodyContents_td_displayPageContainer_props_prefix_0" Then
        Range("E1").Value = (HTMLTr.innerText)
        End If
        
        If HTMLTr.getAttribute("id") = "ctl00_bodyContents_td_displayPageContainer_props_title_0" Then
        Range("F1").Value = (HTMLTr.innerText)
        End If
        
        If HTMLTr.getAttribute("id") = "ctl00_bodyContents_td_displayPageContainer_props_Review_and_Acceptance_Status_2" Then
        Range("G1").Value = (HTMLTr.innerText)
        End If
        
        'Debug.Print HTMLTr.innerText
        
        Next HTMLTr
    
    End Sub
    Last edited by Pepe Le Mokko; 12-09-2019 at 03:38 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Scraping Java Webpage into Excel 2013
    By free008 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-11-2023, 10:04 AM
  2. Trouble Scraping Webpage with Password
    By Josephrandall in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-27-2019, 06:16 AM
  3. [SOLVED] scraping webpage data modification
    By khushboo# in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-13-2017, 11:08 AM
  4. [SOLVED] Help scraping data from webpage into a sheet based on date
    By ozbad5243 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-23-2016, 06:43 PM
  5. [SOLVED] Webpage scraping into Excel - Run-time error '438': Object doesn't support this property..
    By kaseyleigh in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-29-2014, 08:15 AM
  6. Scraping website into excel
    By eodsolo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-12-2014, 06:25 AM
  7. scraping a webpage for flood info
    By yarrick22 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-13-2014, 02:35 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