I can't get table from web(InternetExplorer)

abdelfattah

Well-known Member
Joined
May 3, 2019
Messages
1,429
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Hello
I want to copy the whole TABLE contains values in sheet1 from a1: I as show in table 10 columns . so the website is not english it's arabic . and becarefule the table somtimes contains more than one page as in bottom by arrow should show whole of table . and should update the table automatically in excel without open website .
the code just open website
VBA Code:
Sub OpenBrowser()
Dim IE As New SHDocVw.InternetExplorer
Dim html As MSHTML.HTMLDocument
Dim htmldatas As MSHTML.IHTMLElementCollection
Dim htmldata As MSHTML.IHTMLElement



IE.Visible = True
IE.Navigate "https://www.saudiexchange.sa/wps/portal/tadawul/market-participants/issuers/issuers-directory/company-details/!ut/p/z1/04_Sj9CPykssy0xPLMnMz0vMAfIjo8zi_Tx8nD0MLIy83V1DjA0czVx8nYP8PI0MDAz0I4EKzBEKDEJDLYEKjJ0DA11MjQzcTfW99KPSc_KTIGZllJQUWKkaqBqUJKYklpfmqBroRyXn5xYk5lUGV-Ym5QMVGRkYG-iHEzK1IDsop6zSUREAbm86Ww!!/#chart_tab2"

Do: Loop Until IE.ReadyState = READYSTATE_COMPLETE

Set html = IE.Document

    Set htmldatas = html.body.getElementsByTagName("dataTables_processing")

For Each htmldata In htmldatas
   Debug.Print htmldata.innerText
Next htmldata


End Sub
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I updated this can be logical more than OP but not work !!!
VBA Code:
Sub OpenBrowser()
Dim ie As InternetExplorer
Dim html As IHTMLDocument
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = False
ie.Navigate "https://www.saudiexchange.sa/wps/portal/tadawul/market-participants/issuers/issuers-directory/company-details/!ut/p/z1/04_Sj9CPykssy0xPLMnMz0vMAfIjo8zi_Tx8nD0MLIy83V1DjA0czVx8nYP8PI0MDAz0I4EKzBEKDEJDLYEKjJ0DA11MjQzcTfW99KPSc_KTIGZllJQUWKkaqBqUJKYklpfmqBroRyXn5xYk5lUGV-Ym5QMVGRkYG-iHEzK1IDsop6zSUREAbm86Ww!!/#chart_tab2"
While ie.Busy
    DoEvents
Wend
While ie.ReadyState < 4
    DoEvents
Wend
Set html = ie.Document
Dim elements As IHTMLElementCollection
Set elements = html.getElementsByClassName("dataTables_processing")
For i = 0 To elements.Length - 1
    Sheet1.Range("A" & (i + 1)) = elements(i).innerText
Next i
ie.Quit
Set ie = Nothing

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,394
Messages
6,124,683
Members
449,180
Latest member
kfhw720

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