Kartick0075
New Member
- Joined
- Jan 9, 2020
- Messages
- 18
- Office Version
- 2019
- Platform
- Windows
Dear All Respected Sirs,
Can you please give a solution on how should I count the number of tables on a certain Webpage? For your information, I tried the below code. But, instead of giving me the count of Total no of Tables on that Webpage, it's giving the count of Total no of Rows of all Tables on that page. Please anyone help me.
I'm giving my code below...
------------
Sub Count_Tables_on_a_Webpage ()
Dim IE as SHDocVw.InternetExplorer
Set IE = New ShDocVw.InternerExplorer
IE.Visible = True
IE.Navigate "https://www.wsj.com/ _
market-data/quotes/AAPL/ _
financials/annual/balance-sheet"
Do While IE.ReadyState <> ReadyState_Complete
Dim Doc as MSHTML.HTMLDocument
Set Doc = IE.Document
Dim TBL as MSHTML.IHTMLElement
Dim TBLs as MSHTML.IHTMLElementCollection
Set TBLs = Doc.getElementsbyTagName("Table")
MsgBox TBLs.Length
End Sub
Can you please give a solution on how should I count the number of tables on a certain Webpage? For your information, I tried the below code. But, instead of giving me the count of Total no of Tables on that Webpage, it's giving the count of Total no of Rows of all Tables on that page. Please anyone help me.
I'm giving my code below...
------------
Sub Count_Tables_on_a_Webpage ()
Dim IE as SHDocVw.InternetExplorer
Set IE = New ShDocVw.InternerExplorer
IE.Visible = True
IE.Navigate "https://www.wsj.com/ _
market-data/quotes/AAPL/ _
financials/annual/balance-sheet"
Do While IE.ReadyState <> ReadyState_Complete
Dim Doc as MSHTML.HTMLDocument
Set Doc = IE.Document
Dim TBL as MSHTML.IHTMLElement
Dim TBLs as MSHTML.IHTMLElementCollection
Set TBLs = Doc.getElementsbyTagName("Table")
MsgBox TBLs.Length
End Sub