Hi,
I'm using the following to look for a table. I have seen all the tables it loops through and none are the one I am after.
Looking at the HTML the Table I need is inside tblRates.
How do I loop through Tables within that Table?
*BTW this is Intranet stuff so won't work for testing... Though here is a link to the code
https://ibb.co/n7hB76
I'm using the following to look for a table. I have seen all the tables it loops through and none are the one I am after.
Looking at the HTML the Table I need is inside tblRates.
How do I loop through Tables within that Table?
*BTW this is Intranet stuff so won't work for testing... Though here is a link to the code
https://ibb.co/n7hB76
Code:
Sub runreports()
Dim IE As New SHDocVw.InternetExplorer
Dim HTMLdoc As MSHTml.HTMLDocument
Dim objShellWindows As New SHDocVw.ShellWindows
schedID = Sheets("Schedules").Range("A1").Value
Set IE = GetObject("new:{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}")
With IE
.Visible = True
.Navigate "http://maintrakautest/Domestic/"
While .Busy Or .ReadyState <> 4: DoEvents: Wend
End With
With IE
.Visible = True
.Navigate "http://maintrakau/OnForward/Business/ScheduleFCLNZ1.asp?sid=" & schedID
While .Busy Or .ReadyState <> 4: DoEvents: Wend
Set Schedpage = IE.Document.getElementById("page2")
Schedpage.Click
Set HTMLdoc = IE.Document
ProcessHTMLPage HTMLdoc
End With
IE.Quit
End Sub
Sub ProcessHTMLPage(HTMLPage As MSHTml.HTMLDocument)
Dim HTMLTable As MSHTml.IHTMLElement
Dim HTMLTable1 As MSHTml.IHTMLElement
Dim HTMLTables As MSHTml.IHTMLElementCollection
Dim HTMLTables1 As MSHTml.IHTMLElementCollection
Dim HTMLRow As MSHTml.IHTMLElement
Dim HTMLCell As MSHTml.IHTMLElement
Dim class As MSHTml.IHTMLAttributeCollection
Dim Templatetext As String
Dim NewText As String
Set HTMLTables = HTMLPage.getElementsByTagName("table")
For Each HTMLTable In HTMLTables
If HTMLTable.ID = "tblRates" Then
MsgBox "success"
End If
Next HTMLTable
'tblRates
'tblAdditionalCharges
End Sub
Last edited by a moderator: