dionysus_83
New Member
- Joined
- Feb 24, 2016
- Messages
- 30
Before you say... search in duplicate posts, well, I did and I don't understand what I've done wrong to be able to help myself.
In general, I need table from this page. Ive tried with table queries too to fetch entire table, but with no luck. So I've tried InnerText with grabbing by elements, no luck! Then again by elements by trough parent.child looping. No luck again!
When I go trough debugging I noticed that it can't find it under "ember4675" while it is clearly on the page source...
Part of HTML is in this link: https://pastebin.com/Bq79a0a4
And here is the code:
In general, I need table from this page. Ive tried with table queries too to fetch entire table, but with no luck. So I've tried InnerText with grabbing by elements, no luck! Then again by elements by trough parent.child looping. No luck again!
When I go trough debugging I noticed that it can't find it under "ember4675" while it is clearly on the page source...
Part of HTML is in this link: https://pastebin.com/Bq79a0a4
And here is the code:
Code:
Sub IMPORTMILLS()
Dim x As Long
Dim xObject As Object
Dim xCollection As Object
Dim xButton As Object
Dim xDOC As HTMLDocument
Dim xIE As New InternetExplorer
Dim UN As String
Dim UP As String
UN = Sheets("Username&Passwords").Range("C3")
UP = Sheets("Username&Passwords").Range("D3")
xIE.Visible = True
xIE.navigate "https://go.tradegecko.com/account/sign_in"
With xIE
While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
End With
Application.Wait (Now + TimeValue("0:00:05"))
Set xDOC = xIE.document
On Error Resume Next
Set xUN = xDOC.getElementById("user_email")
xUN.Value = UN
Set xUP = xDOC.getElementById("user_password")
xUP.Value = UP
Set xButton = xDOC.getElementById("login")
xButton.Click
On Error GoTo 0
With xIE
While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
End With
Application.Wait (Now + TimeValue("0:00:05"))
xIE.navigate "https://go.tradegecko.com/inventory"
With xIE
While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
End With
Application.Wait (Now + TimeValue("0:00:05"))
Set xDOC = xIE.document
Set xTable = xDOC.getElementById("ember4675")
xLength = xTable.Length
With ThisWorkbook.Sheets("TempList")
For rowNum = 0 To xTable.Children.Length - 1
For colNum = 0 To xTable.Children(rowNum).Children.Length - 1
.Cells(rowNum + 1, colNum + 1) = xTable.Children(rowNum).Children(colNum).innerText
Next colNum
Next rowNum
End With
End Sub