Results 1 to 2 of 2

Thread: Web scraping on Mac
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Jan 2018
    Post Thanks / Like
    3 Post(s)
    0 Thread(s)

    Default Web scraping on Mac

    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?

    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, html As New HTMLDocument, 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("", _
            "", "")
        Set WinHttpReq = CreateObject("MSXML2.XMLHTTP")
            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
                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 by MoshiM; Sep 6th, 2019 at 01:43 PM.

  2. #2
    Board Regular Rijnsent's Avatar
    Join Date
    Oct 2005
    Utrecht, Holland
    Post Thanks / Like
    1 Post(s)
    0 Thread(s)

    Default Re: Web scraping on Mac

    Hi MoshiM,
    I don't have a Mac, but this project could hold code that does work for you:
    You can't post attachments here, but you can help me helping you by posting a screen shot directly in your post with any of those tools.
    Otherwise use dropbox/google drive/etc to get your file accross (not preferred). For code, put it inside these tags: [ CODE][/CODE]. Do check the forum rules.
    Finally, please show that you made an effort to solve your problem: Yes, I like to help, but am not going to do your job.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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