Buggington
New Member
- Joined
- Mar 28, 2014
- Messages
- 8
Hello
I'm a total VBA newbie, but need to create a data scraping tool. I've managed to find something on YouTube that showed me how to do the majority of what I want, but it doesn't seem to be working.
This is what I have so far:
When I step through the code, everything runs absolutely fine until I get to the "Tabelle1.Range" line, where it seems to skip straight to "Set ie = Nothing" rather than get the data.
Any ideas what's happening here? It's worth noting that I've changed the web URL as it's company data.
Thanks
I'm a total VBA newbie, but need to create a data scraping tool. I've managed to find something on YouTube that showed me how to do the majority of what I want, but it doesn't seem to be working.
This is what I have so far:
Code:
Sub ie_open()
Dim iRet As Integer
Dim strPrompt As String
Dim strTitle As String
' Promt
strPrompt = "Open site to login and find product?"
' Dialog's Title
strTitle = "EPOS"
'Display MessageBox
iRet = MsgBox(strPrompt, vbYesNo, strTitle)
' Check pressed button
If iRet = vbNo Then
MsgBox "Cancelled."
Else
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "[URL="http://www.google.com"]www.google.com[/URL]"
ie.Visible = True
MsgBox "Click OK when page is ready"
End If
Do While ie.Busy: DoEvents: Loop
Set TDelements = ie.Document.getElementsbytagname("GridLabel-")
r = 0
c = 0
For Each TDelement In TDelements
Tabelle1.Range("A1").Offset(r, c).Value = TDelement.innertext
r = r + 1
Next
Set ie = Nothing
End Sub
When I step through the code, everything runs absolutely fine until I get to the "Tabelle1.Range" line, where it seems to skip straight to "Set ie = Nothing" rather than get the data.
Any ideas what's happening here? It's worth noting that I've changed the web URL as it's company data.
Thanks