none
VBA to transfer html page to excel RRS feed

  • Question

  • Hi

    Why  web query Can not url : https://www.instagram.com/leomess/     open To Excel?

    I'm running any other address
    But this address does not work!!!!

    best regard


    • Edited by kapriano Tuesday, September 18, 2018 8:15 AM
    Tuesday, September 18, 2018 8:13 AM

Answers

  • Hi kapriano,

    These Numbers could be import into VBA, but the number 4,365,351 is not on the

    https://www.instagram.com/leomessi/, it is on the https://www.instagram.com/p/Bn58oUIHCaG/?taken -

    by=leomessi this page. 

    Use the following code to get:

    Sub test2()
    
        Dim wb As Object
        Dim doc As Object
        Dim sURL As String
        Set wb = CreateObject("internetExplorer.Application")
        sURL = Cells(2, 1)
        wb.navigate sURL
        wb.Visible = False
        While wb.Busy
          DoEvents
        Wend
        Set doc = wb.document
        Dim Name As String
    
        Dim Num As String
        Name = doc.getElementsByClassName("zV_Nj")(0).innerText
        Num = Mid(Name, 1, 9)
        MsgBox (Num)
    err_clear:
        If Err <> 0 Then
          Err.Clear
          Resume Next
        End If
        wb.Quit
    
    End Sub

    Best Regards,

    Bruce


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.


    Tuesday, September 25, 2018 10:22 AM
    Moderator

All replies

  • Hi Kapriano,

    Could you describe your problem with more details? Or provide an excel spreadsheet like last time, so we

    could better understand your problem and provide a solution for you.

    Also, could you share your code?

    Best Regards,

    Bruce


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.




    Wednesday, September 19, 2018 6:31 AM
    Moderator
  • Hi dear Bruce

    From the following path  I'm giving an Url and import the web page into Excel
    data >from web > new web Query 

    Any web Url  I enter  Works well
    But does not open the Instagram Urls

    Do I have a problem with Excel  Or page content instagram does not give me permission
     
    best regard

    • Edited by kapriano Wednesday, September 19, 2018 6:21 PM
    Wednesday, September 19, 2018 6:13 PM
  • Hi kapriano,

    As I understand it, the feature of Excel does not apply to all websites. So it seems a web structure

    problem(like div/table tags ) and it occurs since you are accessing be protected site.

    You could refer to the following link:

    Error message when you update a data query on your Excel worksheet: "This Web query returned no data"

    Excel Web Query returns no data

    Best Regards,

    Bruce


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.


    • Edited by Bruce Dai -MSFTModerator Thursday, September 20, 2018 10:49 AM
    • Marked as answer by kapriano Thursday, September 20, 2018 1:58 PM
    • Unmarked as answer by kapriano Saturday, September 22, 2018 7:43 PM
    Thursday, September 20, 2018 10:48 AM
    Moderator
  • Hi Bruce

    Thank you for your response.

    But as you can see in the picture
    Can not write VBA to import these numbers into Excel ?

    Of course you already answered this And you said that this forum is not about questions.

    As you can see, these numbers are visible on page codes.

    Best Regard


    • Edited by kapriano Thursday, September 20, 2018 2:36 PM
    Thursday, September 20, 2018 2:33 PM
  • Hi kapriano,

    These Numbers could be import into VBA, but the number 4,365,351 is not on the

    https://www.instagram.com/leomessi/, it is on the https://www.instagram.com/p/Bn58oUIHCaG/?taken -

    by=leomessi this page. 

    Use the following code to get:

    Sub test2()
    
        Dim wb As Object
        Dim doc As Object
        Dim sURL As String
        Set wb = CreateObject("internetExplorer.Application")
        sURL = Cells(2, 1)
        wb.navigate sURL
        wb.Visible = False
        While wb.Busy
          DoEvents
        Wend
        Set doc = wb.document
        Dim Name As String
    
        Dim Num As String
        Name = doc.getElementsByClassName("zV_Nj")(0).innerText
        Num = Mid(Name, 1, 9)
        MsgBox (Num)
    err_clear:
        If Err <> 0 Then
          Err.Clear
          Resume Next
        End If
        wb.Quit
    
    End Sub

    Best Regards,

    Bruce


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.


    Tuesday, September 25, 2018 10:22 AM
    Moderator
  • Hi bruce

    thanks.kiss

    Tuesday, September 25, 2018 8:54 PM