Excel VBA macro no longer working on my iMac












-1















I recently purchased an iMac and moved my EXCEL workbook from Windows. I had this macro set up to import data from a website.



It is no longer working, returning the error "Cannot run ActiveX component"



I've tried looking for the "Import Data -> From a website" button on the Mac OS X version of Excel but I cannot find it. Apparently this is not possible.



Can anyone help rewrite this code?



Sub GetTeamLinks()
Dim HTMLdoc As Object, PageSource As String, url As String, i&, Arr, j&, Tbl
url = "http://mwatch.boursakuwait.com.kw/default.aspx/AllShares"

With CreateObject("MSXML2.XMLHTTP")
.Open "GET", url, True
.send

While .readyState <> 4: DoEvents: Wend 'Check for any connection errors.

If .statusText <> "OK" Then
MsgBox "ERROR" & .Status & " - " & .statusText, vbExclamation
Exit Sub
End If
PageSource = .responseText
End With

Set HTMLdoc = CreateObject("htmlfile")
HTMLdoc.body.innerHTML = PageSource
HTMLdoc.Close

For Each Tbl In HTMLdoc.getElementsByTagName("table")
If Tbl.className = "gridtablethin" Then

ReDim Arr(1 To Tbl.Rows.Length, 1 To Tbl.Rows(0).Cells.Length)
For j = 2 To 86
For i = 2 To UBound(Arr, 1)
If UCase(Sheets("Sheet1").Cells(j, "B")) = Tbl.Rows(i - 1).Cells(0).innerText Then _
Sheets("Sheet1").Cells(j, "F") = Tbl.Rows(i - 1).Cells(1).innerText
Next
Next
End If
Next
End Sub









share|improve this question




















  • 1





    Mac OS explicitly prohibits use of any ActiveX controls as a security measure.

    – David Zemens
    Jan 1 at 19:09






  • 1





    I think this might point you in the right direction, on how to query data from Excel for Mac agentjim.com/MVP/Excel/WebQueryHowTo.html

    – David Zemens
    Jan 1 at 19:12
















-1















I recently purchased an iMac and moved my EXCEL workbook from Windows. I had this macro set up to import data from a website.



It is no longer working, returning the error "Cannot run ActiveX component"



I've tried looking for the "Import Data -> From a website" button on the Mac OS X version of Excel but I cannot find it. Apparently this is not possible.



Can anyone help rewrite this code?



Sub GetTeamLinks()
Dim HTMLdoc As Object, PageSource As String, url As String, i&, Arr, j&, Tbl
url = "http://mwatch.boursakuwait.com.kw/default.aspx/AllShares"

With CreateObject("MSXML2.XMLHTTP")
.Open "GET", url, True
.send

While .readyState <> 4: DoEvents: Wend 'Check for any connection errors.

If .statusText <> "OK" Then
MsgBox "ERROR" & .Status & " - " & .statusText, vbExclamation
Exit Sub
End If
PageSource = .responseText
End With

Set HTMLdoc = CreateObject("htmlfile")
HTMLdoc.body.innerHTML = PageSource
HTMLdoc.Close

For Each Tbl In HTMLdoc.getElementsByTagName("table")
If Tbl.className = "gridtablethin" Then

ReDim Arr(1 To Tbl.Rows.Length, 1 To Tbl.Rows(0).Cells.Length)
For j = 2 To 86
For i = 2 To UBound(Arr, 1)
If UCase(Sheets("Sheet1").Cells(j, "B")) = Tbl.Rows(i - 1).Cells(0).innerText Then _
Sheets("Sheet1").Cells(j, "F") = Tbl.Rows(i - 1).Cells(1).innerText
Next
Next
End If
Next
End Sub









share|improve this question




















  • 1





    Mac OS explicitly prohibits use of any ActiveX controls as a security measure.

    – David Zemens
    Jan 1 at 19:09






  • 1





    I think this might point you in the right direction, on how to query data from Excel for Mac agentjim.com/MVP/Excel/WebQueryHowTo.html

    – David Zemens
    Jan 1 at 19:12














-1












-1








-1








I recently purchased an iMac and moved my EXCEL workbook from Windows. I had this macro set up to import data from a website.



It is no longer working, returning the error "Cannot run ActiveX component"



I've tried looking for the "Import Data -> From a website" button on the Mac OS X version of Excel but I cannot find it. Apparently this is not possible.



Can anyone help rewrite this code?



Sub GetTeamLinks()
Dim HTMLdoc As Object, PageSource As String, url As String, i&, Arr, j&, Tbl
url = "http://mwatch.boursakuwait.com.kw/default.aspx/AllShares"

With CreateObject("MSXML2.XMLHTTP")
.Open "GET", url, True
.send

While .readyState <> 4: DoEvents: Wend 'Check for any connection errors.

If .statusText <> "OK" Then
MsgBox "ERROR" & .Status & " - " & .statusText, vbExclamation
Exit Sub
End If
PageSource = .responseText
End With

Set HTMLdoc = CreateObject("htmlfile")
HTMLdoc.body.innerHTML = PageSource
HTMLdoc.Close

For Each Tbl In HTMLdoc.getElementsByTagName("table")
If Tbl.className = "gridtablethin" Then

ReDim Arr(1 To Tbl.Rows.Length, 1 To Tbl.Rows(0).Cells.Length)
For j = 2 To 86
For i = 2 To UBound(Arr, 1)
If UCase(Sheets("Sheet1").Cells(j, "B")) = Tbl.Rows(i - 1).Cells(0).innerText Then _
Sheets("Sheet1").Cells(j, "F") = Tbl.Rows(i - 1).Cells(1).innerText
Next
Next
End If
Next
End Sub









share|improve this question
















I recently purchased an iMac and moved my EXCEL workbook from Windows. I had this macro set up to import data from a website.



It is no longer working, returning the error "Cannot run ActiveX component"



I've tried looking for the "Import Data -> From a website" button on the Mac OS X version of Excel but I cannot find it. Apparently this is not possible.



Can anyone help rewrite this code?



Sub GetTeamLinks()
Dim HTMLdoc As Object, PageSource As String, url As String, i&, Arr, j&, Tbl
url = "http://mwatch.boursakuwait.com.kw/default.aspx/AllShares"

With CreateObject("MSXML2.XMLHTTP")
.Open "GET", url, True
.send

While .readyState <> 4: DoEvents: Wend 'Check for any connection errors.

If .statusText <> "OK" Then
MsgBox "ERROR" & .Status & " - " & .statusText, vbExclamation
Exit Sub
End If
PageSource = .responseText
End With

Set HTMLdoc = CreateObject("htmlfile")
HTMLdoc.body.innerHTML = PageSource
HTMLdoc.Close

For Each Tbl In HTMLdoc.getElementsByTagName("table")
If Tbl.className = "gridtablethin" Then

ReDim Arr(1 To Tbl.Rows.Length, 1 To Tbl.Rows(0).Cells.Length)
For j = 2 To 86
For i = 2 To UBound(Arr, 1)
If UCase(Sheets("Sheet1").Cells(j, "B")) = Tbl.Rows(i - 1).Cells(0).innerText Then _
Sheets("Sheet1").Cells(j, "F") = Tbl.Rows(i - 1).Cells(1).innerText
Next
Next
End If
Next
End Sub






excel vba macos excel-vba excel-vba-mac






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 19:06









John Coleman

35.3k53376




35.3k53376










asked Jan 1 at 18:56









nowifi6952nowifi6952

11




11








  • 1





    Mac OS explicitly prohibits use of any ActiveX controls as a security measure.

    – David Zemens
    Jan 1 at 19:09






  • 1





    I think this might point you in the right direction, on how to query data from Excel for Mac agentjim.com/MVP/Excel/WebQueryHowTo.html

    – David Zemens
    Jan 1 at 19:12














  • 1





    Mac OS explicitly prohibits use of any ActiveX controls as a security measure.

    – David Zemens
    Jan 1 at 19:09






  • 1





    I think this might point you in the right direction, on how to query data from Excel for Mac agentjim.com/MVP/Excel/WebQueryHowTo.html

    – David Zemens
    Jan 1 at 19:12








1




1





Mac OS explicitly prohibits use of any ActiveX controls as a security measure.

– David Zemens
Jan 1 at 19:09





Mac OS explicitly prohibits use of any ActiveX controls as a security measure.

– David Zemens
Jan 1 at 19:09




1




1





I think this might point you in the right direction, on how to query data from Excel for Mac agentjim.com/MVP/Excel/WebQueryHowTo.html

– David Zemens
Jan 1 at 19:12





I think this might point you in the right direction, on how to query data from Excel for Mac agentjim.com/MVP/Excel/WebQueryHowTo.html

– David Zemens
Jan 1 at 19:12












1 Answer
1






active

oldest

votes


















0














try deleting:



With CreateObject("MSXML2.XMLHTTP")
.Open "GET", url, True
.send


and replacing it with:



ActiveWorkbook.FollowHyperlink "http://mwatch.boursakuwait.com.kw/default.aspx/AllShares"





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53998097%2fexcel-vba-macro-no-longer-working-on-my-imac%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    try deleting:



    With CreateObject("MSXML2.XMLHTTP")
    .Open "GET", url, True
    .send


    and replacing it with:



    ActiveWorkbook.FollowHyperlink "http://mwatch.boursakuwait.com.kw/default.aspx/AllShares"





    share|improve this answer




























      0














      try deleting:



      With CreateObject("MSXML2.XMLHTTP")
      .Open "GET", url, True
      .send


      and replacing it with:



      ActiveWorkbook.FollowHyperlink "http://mwatch.boursakuwait.com.kw/default.aspx/AllShares"





      share|improve this answer


























        0












        0








        0







        try deleting:



        With CreateObject("MSXML2.XMLHTTP")
        .Open "GET", url, True
        .send


        and replacing it with:



        ActiveWorkbook.FollowHyperlink "http://mwatch.boursakuwait.com.kw/default.aspx/AllShares"





        share|improve this answer













        try deleting:



        With CreateObject("MSXML2.XMLHTTP")
        .Open "GET", url, True
        .send


        and replacing it with:



        ActiveWorkbook.FollowHyperlink "http://mwatch.boursakuwait.com.kw/default.aspx/AllShares"






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 1 at 21:11









        JaneJane

        720218




        720218
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53998097%2fexcel-vba-macro-no-longer-working-on-my-imac%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            Npm cannot find a required file even through it is in the searched directory