Web scraping on Mac

MoshiM

Active Member
Joined
Jan 31, 2018
Messages
439
Office Version
  1. 2016
Platform
  1. Windows
I'm using the following macro to scrape a DropBox web page for a string and compare it to a stored value within a worksheet to determine if an update for the workbook is available. This all works on Windows but I get an error when I try and dim a HtmlDocument object or use createobject("MSXML2.XMLHTTP") or (not shown)createobject("htmlfile"). What other options do I have if these don't work?

Code:
Private Function Update_Date() As Boolean

Dim Path As String, Update As Double, DD As Byte, WinHttpReq As Object, FileN As String, Update_Range As Range, _
Partial_P As String, [COLOR=#b22222]html As New HTMLDocument,[/COLOR] STR_AR() As String, X As Byte, File_Type As String

Set Update_Range = Variable_Sheet.ListObjects("Saved_Variables"). _
    DataBodyRange.Find("Update", LookIn:=xlValues, lookat:=xlWhole).Offset(0, 1)
    
File_Type = Update_Range.Offset(1, 0).Value2

FileN = "Date_Check.txt"

X = Application.Match(File_Type, Array("L", "D", "T"), 0) - 1

    Partial_P = Replace("https://www.dropbox.com/s/7lwhmhul1pqxbf9/Date_Check.txt?dl=0", _
        "www.dropbox.com", "dl.dropboxusercontent.com")
   
    [COLOR=#a52a2a]Set WinHttpReq = CreateObject("MSXML2.XMLHTTP")[/COLOR]
        
        With WinHttpReq
        
            .Open "GET", Partial_P, False 'File is a URL/web page: False means that it has to make the connection before moving on
            .send

            html.Body.innerHTML = .responseText
        
        End With
        
    If Round(Update_Range.Value2, 10) < Round(Split(html.Body.FirstChild.Data, ",")(X), 10) Then Update_Date = True

end function
 
Last edited:

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top