+ Reply to Thread
Results 1 to 24 of 24

Web scraping using VBA

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (24 H2) 64 Bit
    Posts
    1,185

    Re: Web scraping using VBA

    As I've mentioned, you cannot use XMLHTTP library for this URL.

    Sub Test2()
        ' Haluk - 17/07/2020
        '
        Dim HTTP As Object, HTML As Object
        Dim URL As String
    
        URL = "https://www.g2a.com/pl-pl/minecraft-windows-10-edition-microsoft-key-global-i10000032198001"
       
        Set HTTP = CreateObject("MSXML2.XMLHTTP")
        Set HTML = CreateObject("HTMLFILE")
       
        HTTP.Open "GET", URL, False
        HTTP.send
        
        MsgBox HTTP.statusText
        
        Set HTML = Nothing
        Set HTTP = Nothing
    End Sub

    Or, using WINHTTP class;


    Sub Test3()
        ' Haluk - 18/07/2020
        '
        Dim W As Object
        Dim URL As String
        
        URL = "https://www.g2a.com/pl-pl/minecraft-windows-10-edition-microsoft-key-global-i10000032198001"
        
        On Error Resume Next
            Set W = CreateObject("winhttp.winhttprequest.5")
            If Err.Number <> 0 Then
                Set W = CreateObject("winhttp.winhttprequest.5.1")
            End If
        On Error GoTo 0
        
        W.Open "GET", URL, False
        W.Send
        
        MsgBox W.ResponseText
        
        Set W = Nothing
    End Sub
    If it was not restricted; you could get the "response text" and write to a HTML file in memory and then get the desired data from that response.
    Last edited by Haluk; 07-18-2020 at 08:21 AM.

+ 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. [SOLVED] VBA Web Scraping
    By dddddmex in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-13-2020, 11:36 AM
  2. Web Scraping
    By CheekyMonkeh in forum Excel General
    Replies: 1
    Last Post: 10-15-2018, 02:43 PM
  3. Web Scraping using VBA
    By perpectuals in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2018, 03:08 PM
  4. Web Scraping Help
    By rbuchei in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-01-2016, 11:39 PM
  5. help from web scraping
    By kirby21 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-31-2015, 08:59 PM
  6. New to VBA - Web Scraping
    By cringle in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 12-17-2013, 08:26 AM
  7. [SOLVED] Web scraping with xml
    By abousetta in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-24-2012, 05:25 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